Adding event handler.