broke up the error handling