Improved the logging for easier debugging