Changed more error messages to be written to stderr rather than stdout.