Improved the logging system