refactored print functions