adds support for passing in number of iterations
updates tests code