Customizing events through code