change templates logic