Allow number of iterations to be specified