fixed looping logic
Merge pull request #32 from DavidDaCosta/patch-1

fixed looping logic