         
         var attribute: Attribute {
             
-            let handleBytes = serviceHandle.littleEndian.bytes
-            
-            let endGroupBytes = endGroupHandle.littleEndian.bytes
-            
-            let value: Data = [handleBytes.0,
-                               handleBytes.1,
-                               endGroupBytes.0,
-                               endGroupBytes.1] + uuid.littleEndian.data
+            var data = Data(capacity: 4 + uuid.dataLength)
+            data += serviceHandle.littleEndian
+            data += endGroupHandle.littleEndian
+            data += uuid.littleEndian
             
             return Attribute(handle: handle,
                              uuid: type(of: self).uuid,
-                             value: value,
+                             value: data,
                              permissions: [.read])
         }
         

    /// The attribute at the specified index.
    public subscript(index: Int) -> Attribute {
        
        get { return attributes[index] }
    }
    
    /// The attribute with the specified handle.

        init?(attribute: Attribute) {
            
            guard attribute.uuid == type(of: self).uuid,
                let _ = Length(rawValue: attribute.value.count)
                else { return nil }
            
            assert(attribute.permissions == [.read], "Invalid attribute permissions")
            
            let serviceHandle = UInt16(littleEndian: UInt16(bytes: (attribute.value[0], attribute.value[1])))
            let endGroupHandle = UInt16(littleEndian: UInt16(bytes: (attribute.value[2], attribute.value[3])))
            let uuid = BluetoothUUID(littleEndian: BluetoothUUID(data: attribute.value.suffixNoCopy(from: 4))!)
            
            self.serviceHandle = serviceHandle
            self.endGroupHandle = endGroupHandle
