the lzw encode / decode algorithm seems to work well enough, but could be optimized and i'm worried there are still some lingering issues ...