LazyIter class replaces lazy_iter function
Refactored lazy iteration to reduce repeat file iteration and back-seeking