begin refactor of render_text
end refactoring of render_text