making findevents into a function