refactor printer