improved the code for proxy feature