balancing the tree