to aid readability, split up the event delegation setup to its own function