Pull out a subclass so it can be used elsewhere.
Move non-group join conditions as well when possible.
Adjust some expected results.