PEP8 compliance, and also got rid of some unused modules/variables
Using the logging module instead of custom function
Changed the log format