rebuild the findRoot, findChildren and buildTree methods