Huffman implementation