initial version of event handling