Change iterators architecture and add tests