improved event handling.