Updates to the error handling to make it more consistent