rewrote to conform to PEP8

used pylint and autopep8