Implement compression

Fixes #88