[ref] Test and function clean up