Added error handling to asynchronous calls.