Clean up functions and methods