refactored the http client