Added error messages, and cleaned up printError() calls.