Improved eventHandler