Implemented some perf improvements
Updated to use more efficient for loop
Merge pull request #52 from firebase/jw-perf-improvements

Implemented some perf improvements