some de-uglification of text routines