Adding custom event logic