Implement better error handling.