Additional refactoring to use the QuerySequence wrapper, so that we can still