Added extend function to extend number of iterations.