Minor cleanups

Fix some typos and simplify a few code snippets.