refactor_addText_function