optimize the text structure