some changes to event handling