added initial support for client to proxy comunication and also cleaned up more code in numerous places