Added a better logging system using the logging module

All in one commit now.
EDIT: Besides, squashing commits kind of ruins the purpose source control. Makes it a lot harder to trace back errors/problems with fewer commits.