Cleanup a function.