Cleaning up error handling