add maxIterations argument and set default