updating avl tree to improve performance; need to clean up though
updating avl tree code for performance; need to clean up though