utils for iterating the reader