More work on query tree structure.