Moved the proxying logic out to its own structures.  Currently leaks memory
Fixed memory leak