renamed function 'NextEvent' to 'WaitEvent'