refactoring code in "proxy" dir