add max iterations feature