added logic for extracting events from a contact.