create and update template