Added option for loops with a constant number of iterations