completed template computation