Tweaks to map masking code