add comments and fix pep8