Used a more sane default value.
Added a maximum number of iterations.