moved mask handling into handleF

allows for more extensive checking