cleaned up logging and added a logger
pep8 fixes