added some balancing funcd to the tree