Added freeEvents function