     /// The value of the characteristic is a bit mask implemented as an array of unsigned 8 bit integers.
     var bitmaskArray: Data {
         
-        if rawValue <= numericCast(UInt8.max) {
-            
-            return Data([UInt8(rawValue)])
-            
-        } else if rawValue <= numericCast(UInt16.max) {
-            
-            let bytes = UInt16(rawValue).littleEndian.bytes
+        if self <= numericCast(UInt8.max) {
+            
+            return Data([UInt8(self)])
+            
+        } else if self <= numericCast(UInt16.max) {
+            
+            let bytes = UInt16(self).littleEndian.bytes
             
             return Data([bytes.0, bytes.1])
             
-        } else if rawValue <= numericCast(UInt32.max) {
-            
-            let bytes = UInt32(rawValue).littleEndian.bytes
+        } else if self <= numericCast(UInt32.max) {
+            
+            let bytes = UInt32(self).littleEndian.bytes
             
             return Data([bytes.0, bytes.1, bytes.2, bytes.3])
             
-        } else if rawValue <= numericCast(UInt64.max) {
-            
-            let bytes = UInt64(rawValue).littleEndian.bytes
+        } else {
+            
+            let bytes = self.littleEndian.bytes
             
             return Data([bytes.0, bytes.1, bytes.2, bytes.3, bytes.4, bytes.5, bytes.6, bytes.7])
-            
-        } else {
-            
-            fatalError("\(rawValue) is to big to encode into byte array")
-        }
-    }
-}
+        }
+    }
+}

    
    public init?(data: Data) {
        
        guard let bitmask = BitMaskOptionSet<Category>(bitmaskArray: data)
            else { return nil }
        
        self.categories = bitmask
    }
    
    public var data: Data {
        
        return categories.bitmaskArray
    }
    
    public var characteristic: GATT.Characteristic {

    
    public init?(data: Data) {
        
        guard let bitmask = Category.RawValue(bitmaskArray: data)
            else { return nil }
        
        self.categories = BitMaskOptionSet<Category>(rawValue: bitmask)
    }
    
    public var data: Data {
        
        return categories.rawValue.bitmaskArray
    }
    
    public var characteristic: GATT.Characteristic {
