working proxy handler with better logging