A medical device for classifying cardiac beats for use in detecting cardiac rhythms, comprising: a plurality of electrodes (24, 26, 28) for sensing an extravascular ECG signal over a plurality of cardiac cycles and for sensing a extravascular ECG signal having an unknown morphology, over a plurality of cardiac cycles; and a processor configured to: determine a template of a known cardiac signal in response to the extravascular ECG signal sensed over the plurality of cardiac cycles; determine a template alignment point from the template of the known cardiac signal; and; determine a fourth order difference signal by applying a fourth order difference function to the extravascular ECG signal having an unknown morphology; determine an alignment point for the extravascular ECG signal having an unknown morphology from the fourth order difference signal; align the template and the extravascular ECG signal having an unknown morphology across an alignment window by aligning the template alignment point and the alignment point of the extravascular ECG signal having an unknown morphology; determine a first morphology match metric measuring a similarity between the aligned template and the extravascular ECG signal having an unknown morphology; and classify the extravascular ECG signal having an unknown morphology based on the determined first morphology match metric. a plurality of electrodes (24, 26, 28) for sensing an extravascular ECG signal over a plurality of cardiac cycles and for sensing a extravascular ECG signal having an unknown morphology, over a plurality of cardiac cycles; and a processor configured to: determine a template of a known cardiac signal in response to the extravascular ECG signal sensed over the plurality of cardiac cycles; determine a template alignment point from the template of the known cardiac signal; and; determine a fourth order difference signal by applying a fourth order difference function to the extravascular ECG signal having an unknown morphology; determine an alignment point for the extravascular ECG signal having an unknown morphology from the fourth order difference signal; align the template and the extravascular ECG signal having an unknown morphology across an alignment window by aligning the template alignment point and the alignment point of the extravascular ECG signal having an unknown morphology; determine a first morphology match metric measuring a similarity between the aligned template and the extravascular ECG signal having an unknown morphology; and classify the extravascular ECG signal having an unknown morphology based on the determined first morphology match metric. determine a template of a known cardiac signal in response to the extravascular ECG signal sensed over the plurality of cardiac cycles; determine a template alignment point from the template of the known cardiac signal; and; determine a fourth order difference signal by applying a fourth order difference function to the extravascular ECG signal having an unknown morphology; determine an alignment point for the extravascular ECG signal having an unknown morphology from the fourth order difference signal; align the template and the extravascular ECG signal having an unknown morphology across an alignment window by aligning the template alignment point and the alignment point of the extravascular ECG signal having an unknown morphology; determine a first morphology match metric measuring a similarity between the aligned template and the extravascular ECG signal having an unknown morphology; and classify the extravascular ECG signal having an unknown morphology based on the determined first morphology match metric.