Clean up error handling a bit