iswaitingonevent function added