added support for event handling