Added error handling for request parameters