made templateRenderer a function and split out command line argument code