refactor & avl test