     case WrongBlockSize
     /// Unknown block type (was neither 'pi' nor 'sqrt(pi)').
     case WrongBlockType
+    case RandomizedBlock
+    case WrongHuffmanGroups
+    case WrongSelector
 }
 
 /// Provides function to decompress data, which were compressed using BZip2

        return out
    }

    private func decodeHuffmanBlock(data: DataWithPointer) throws -> Data {
        return Data()
    }



        while true {
            let blockType = convertToInt(uint8Array: pointerData.bits(count: 48))
            // Next 32 bits are crc (which currently is not checked).
            let _ = convertToInt(uint8Array: pointerData.bits(count: 32))

            if blockType == 0x314159265359 {
                try out.append(decodeHuffmanBlock(data: pointerData))
            } else if blockType == 0x177245385090 {
                // TODO: Decide, if skipping is necessary
                pointerData.skipUntilNextByte()
                break
            } else {
                throw BZip2Error.WrongBlockType
            }
