Add cleanup function and callback binding