Refactored httpclient.