Use objects to simulate closures

Lame, but greatly improves perf and reduces memory in v8