Cleanup code and pep8