refine the code, compress and decompress is faster now