Implemented AVL tree balancing.