Updated Huffman encoding code skeleton