tie template to model