On-the-fly compression, closes #7