updated LZW compression algorithm