Some changes for more sensible output when running from command line.