Enhancing Atrial Fibrillation Detection Using Adaptive Template Matching