better cleanup of events