Modified some event handling