adding event functionality