Improve error handling and grabbing data from the request response