refactored print messages in its own class