Improved logger, refactored some stuff