added proper proxy handling and using an http client interface