export a function for ~leave