added end event listener