remove for-in loops that prevent JIT optimization
avoid repeated allocation of constant object
Merge pull request #6 from msridhar/optimizations

Optimizations