Shorten some event-handling code.