Add local index variable to loop

Was taking a look at the project -- noticed Travis wasn't green. Seemed like an easy fix!
Merge pull request #5 from tjarratt/patch-1

Add local index variable to loop