small cleanup to events code