handle events better