refactored error handling to be more brief