Changed name generater to use for loop.