Make an iterated query stub reusable

See #6