Increased String generation speed by a lot

For example, for n=100 it is now 100 times faster. 
Some other minor changes