Adding some event handling.