Adding writing out the error message only to stdout. Adding better tests for logging