Reorganizing tree structure