Tidied up all the logging.