refactor Printer and add test to it