Share code between iterators