splay and erase function