switching to event listener model