     
     public var willRead: ((UUID: Bluetooth.UUID, value: Data, offset: Int) -> ATT.Error?)?
     
-    public var willWrite: ((UUID: Bluetooth.UUID, value: Data, newValue: (newValue: Data, newBytes: Data, offset: Int)) -> ATT.Error?)?
+    public var willWrite: ((UUID: Bluetooth.UUID, value: Data, newValue: Data) -> ATT.Error?)?
     
     public let maximumPreparedWrites: Int
     

            
        case .Write:
            
            var newValues = [Data](repeating: Data(), count: preparedWrites.count)
            
            // validate
            for (index, write) in preparedWrites.enumerated() {
                
                let attribute = database[write.handle]
                
                let newData = prepareNewValue(currentValue: attribute.value.byteValue, newBytes: write.value, offset: write.offset)
                
                // validate application errors with write callback
                if let error = willWrite?(UUID: attribute.UUID, value: attribute.value, newValue: (Data(byteValue: newData), Data(byteValue: write.value), Int(write.offset))) {
                    
                    errorResponse(opcode, error, write.handle)
                    return
                }
                
                newValues[index] = Data(byteValue: newData)
            }
            
            // write
            for (index, write) in preparedWrites.enumerated() {
                
                let newValue = newValues[index]
                
                database.write(newValue, forAttribute: write.handle)
            }
            
        case .Cancel: break // queue always cleared

        }
        
        return value
    }
    
    // MARK: Callbacks
