I don't like the fact that u use for loops to traverse a global.
In most programming languages for loops are for when you know the number of iterations needed in advance.

 

see quote below straight from stackoverflow:   http://stackoverflow.com/a/2950945

The main difference between the for's and the while's is a matter of pragmatics: we usually use for when there is a known number of iterations, and use while constructs when the number of iterations in not known in advance. The while vs do ... while issue is also of pragmatics, the second executes the instructions once at start, and afterwards it behaves just like the simple while.