cleaned code and added support for proxy (web transport)