Add masking

Fixes for event handlers.