refactor writers