Add event handling to the example