Wrote iterative method