cleaned up proxy handler code