Further implemented the iterator algorithm.