This new implementation explicitly tracks the children of each node, eliminating many iterations through the full tree.