add event listener and add tests