add multithreading for multiple input files, simplify compression algorithm