Make templates better

I made my script handle comments more correctly.