Added event handling