Improve code formatting and fix a few typos in docs. Contributed by @sumnerevans at Beeper.