move from query to queryIterator method