add a cleanup function