Added current event and next event algorithm