Updated response and error handling