Added lzwEncode function