Restructure the tree