added a n_iter_only_ option to stop after a certain number of iterations and print statistics