moved the global tpl vars into own method to be called seperatly