Correctly set variables for template