Template variable substitution working ok now