adding priority handling for events
added ordering function of events