     }
 
     private func extractByteOne() throws -> (maskKeyIncluded: Bool, payloadLength: Byte) {
-        guard let byteOne = try next() else {
+        guard let byteOne = try buffer.next() else {
             throw "493: WebSockets.Swift: MessageParser"
         }
         let maskKeyIncluded = byteOne.containsMask(.maskKeyIncluded)

        var count: UInt64 = 0
        var bytes: [UInt8] = []

        switch key {
        case .none:
            while count < length, let next = try next() {
                bytes.append(next)
                count += 1
            }
        case let .key(zero: zero, one: one, two: two, three: three):
            /*
             Octet i of the transformed data ("transformed-octet-i") is the XOR of
             octet i of the original data ("original-octet-i") with octet at index
             i modulo 4 of the masking key ("masking-key-octet-j"):

             j                   = i MOD 4
             transformed-octet-i = original-octet-i XOR masking-key-octet-j
             */

            // needs to be UInt64 because that's max payload length and we need the space
//            var count = UInt64(0)
            let keys = [zero, one, two, three]
            while count < length, let original = try next() {
                let key = keys[Int(count % 4)]
                let transformed = original ^ key
                bytes.append(transformed)
                count += 1
            }

        }

        return bytes
    }
}


    private func extractExtendedPayloadLength(_ length: ExtendedPayloadByteLength) throws -> UInt64 {
        var bytes: [Byte] = []
        for _ in 1...length.rawValue {
            guard let next = try buffer.next() else {
                throw "522: WebSockets.Swift: MessageParser"
            }
            bytes.append(next)
