Replace BitSet with custom Mask type.