What would be the benefit of doing that?  It made sense for the one you pointed out above because there were unnecessary nested loops.  However, for this loop each index is from `0` to `perimeterPositions` is used exactly once.  (I did change it to a for loop instead, the while loop wasn't doing anything special anymore)