adding event handling and output display