         return bitsCount % 8 == 0 ? bitsCount / 8 : bitsCount / 8 + 1
     }
 
-    private static func createUncompressedBlock(_ bytes: [UInt8]) -> [UInt8] {
+    private static func createUncompressedBlock(_ data: Data) -> Data {
         let bitWriter = BitWriter(bitOrder: .reversed)
 
         // Write block header.

        bitWriter.finish()

        // Write data's length.
        bitWriter.write(number: bytes.count, bitsCount: 16)
        // Write data's n-length.
        bitWriter.write(number: bytes.count ^ (1 << 16 - 1), bitsCount: 16)

        var out = bitWriter.buffer

        // Write actual data.
        for byte in bytes {
            out.append(byte)
        }

        return out
    }


                // Again, the distance cannot be greater than 32768.
                if distance <= 32768 {
                    while inputIndex + matchLength < data.count &&
                        data[inputIndex + matchLength] == data[repeatIndex] && matchLength < 258 {
                            matchLength += 1
                            repeatIndex += 1
                            if repeatIndex > inputIndex {
