Event handling code moved to its own namespace.