Refactor to clarify and enhance performance

The code should be easier to understand now, and has a more flexible API.
Thanks to the latter, we now get better performance. Before, we had to
iterate the whole array of markers generated by `injectHints` both before
and after `addHuffmanCodeWordsTo`. Now, that is not necessary anymore.