Continued refactoring error handling