add QueryIterator and tests