Using page cache and AppendIterator, refactoring code