Changed some event handling