moved text functions to a sensible place