added logic to search for TO in main event (if no subevents) as well as in subevents (if there are some)