Changed formula of getting the last event