added basic event handling