Changed condition to iterate 1000 times