Improved some of the formatting.

Made the code more readable, and improved some of the comments.