use function instead of object.handleEvent to handle events