Simplify error handling and add context to error messages to make them understandable