Added Mode event handling