5. tying logic to events