Enhanced response and error handling