locally scope iterators

should be var i = 0 instead of simply i = 0