writing function proxy_thread