Pep8 cleanup

Ran a pep8 linter and cleaned up code. Also added a bunch of comments into the codebase.