Added error logging and more verbose output.