update text generate function