Added generic event handling.