added more event handling