updated event handling, still not good