switching from httpwebrequest to httpclient, reduction of code