calculate templates