sarted the switch-events
added loggly and changed the logic for event_max_duration