could we do one better and define this outside the event listener?