Implement log compaction

closes #59