Added complete support for compression. Both reading and writing are now possible.