Update to error handling