Update compress.cpp, complete implementation may have bugs (need to test it out)