refactoring printf