Added add event function