Added an iteration limit of 1000