Fixed and improved loggging.