various improvements + set_compression_level rewrite