Added more error catching to HTTP requests