Re factoring of Proxy.php

Refactored  proxy.php code