Fixed templating script. Should work now.