Added some printing to check the construction of the tree.