Adding option for number of iterations