huffman is mostly working, except the end case can be streamlined