Lots of style cleanup.

Also moved the date formatting to utils.py, and added unit tests for it.
Removed inline comments. If explanations are needed, put them in the docstring.
Merge pull request #1 from EdLeafe/master

Style changes