Better mask handling