Function definition for killtree.