initial revision of the proxy handler, still contains a lot of bugs