Added support for a max iterations counter