Code cleanup, documentation, and tweaks due to code review.