Refactor cljam.sam.writer