Added global reference to template variables... Thanks SRounce!