switch to more concise error handling