refactor of httpclient