Implementing better error handling.