Added 'ontrack' event. 'Leaving' event is ignored if there's a train.