Swap the order of the iterators to separate them in a more logical manner

Also adds an all int param version of the iterator because it produces the
cleanest loops.

e.g. 'for i in 1..10' turns into 'for (i=1; i<=10; i+=1)' with no temp
variables