Code cleaning, documentation mostly done

Code now mostly adheres to PEP8. Most functions and classes have some sort
of docstring now.
Still need to add more comments and refactor the modules.