Minor stylistic changes, added docstrings

Just some stylistic changes.

A couple lines were over 80 characters, miscellaneous stuff like that.
Changed comments above functions to docstrings within them as per PEP 8, in addition to adding some new ones.