Rewrite string generation. Now generates faster.