The code that handles the text buffer is lame, and needs to be improved.

Use an explicit StringBuffer instead of temporaries in Strings
