Update logic for avl tree.