converted eventHandler to a first-class object