end event functionality