Refactor some text functions to newer styles