Solved issues with the fact that iterators are immutable.