Added comments, light formatting changes.

Added comments to all files, and lightly modified the formatting of some
files to improve readability.