Added test for tree restructuring