added lines iterator method to make it potentially more efficient when
taking only a few lines from the input