Cleaning up event handling.