optimizing loops
removing incorrect optimization
Merge pull request #1615 from shanethehat/loop-optimization

Optimizing loops
Merge remote-tracking branch 'upstream/master'