Move event checker into its own function