refactored print class