<pre>function wdt2 T,N  put the length of T into L  if  L < (N*1.2) then put chr(27) & chr(69) & T into R  else if L < (N*1.4) then put chr(27) & chr(101) & T & chr(27) & chr(69) into R  else if L < (N*1.53) then put chr(27) & chr(113) & T & chr(27) & chr(69) into R  else if L < (N*1.73) then put chr(27) & chr(81) & T & chr(27) & chr(69) into R  else    put trunc(N*1.73) into max    put trunc(max/2) into min    repeat with P = max down to min      if char P of T is in " ,.!?&->)]}" then exit repeat    end repeat    put wdt(char 1 to P of T,N) & return into R    put wdt(ltrim(char P+1 to L of T),N) after R  end if  return Rend wdt2</pre>