#1772: Refactored the tree query match code and removed debugging code (as the same information can be obtained with IntelliTrace).