refactored unscape to be tailrec and to use Stringbuilder