refactored the NSAttributed string rendering