Fix and rework the iterators.