reorganized event-handling examples