Refactor layoutText.