more pythonic
added logger with debug log
whitespace and tabs clean up