moved add event out of interrupt handler in example