Added cloud function to clean up events.