Modify EventDispatcher to use priorities instead of a list of event handlers.