Added the iterative solution