Cleanup methods in listener and plugin