Beginning to abstract the subquery