Simplify the structure of custom event handlers