Refactored Error Handling Complete