Added error as output, clean up logging