Added comment to explain why we need to capture the value in the event listener.