Refined generation process

Now the function loop through all the different tpl files to produce
different code needed and name them accordingly.