Implement more of the query building logic from the normalized tree, the bugs now lie there