refactored error output