printer class refractored