Updates to error handling