added ability to define instance variables in template