Make Pair generic.
Refactor query assertions.