cleanup function defs