refactoring : extracted method print_styled_text