using event listener instead of callback