adds event functionality