Updated the logging to something more sophisticated.