A method of generating a template in an implantable medical device for
implantation within a patient, and a processor readable medium for
performing the method, that includes generating a template from collected
events corresponding to the patient, delaying the generation of the
template for a first predetermined time period in response to the
template not being generated within a predetermined number of collected
events, determining whether the template is valid, and monitoring the
template to determine whether the template is an accurate representation
of the patient.