Diagnosis and treatment of cardiac arrhythmias