Refactor file iterators.