moved huffman array directly into function (it's ugly, I know) to obviate need for global variables. should be refactored in the future