Refactored Huffman