added template analysis