         guard indexPath.row > 0 else { return nil }
         
         if indexPath.row == 1 {
-            guard (indexPath.section == 0 && studyEntries.value.count > 0) ||
-                (indexPath.section == 1 && learnedEntries.value.count > 0) else { return nil }
+            guard viewModel.studyEntries.value.count > 0 else { return nil }
         }
         
         let idx = indexPath.row - 1
-        
-        return indexPath.section == 0 ?
-            studyEntries.value[idx] :
-            learnedEntries.value[idx]
+        return viewModel.studyEntries.value[idx]
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    }
    
    func studyCellMarkLearnedTapped(entry: StudyEntry) {
        if let index = studyEntries.value.index(of: entry) {
            markLearned(indexPath: IndexPath(row: index + 1, section: 0))
        } else if let index = learnedEntries.value.index(of: entry) {
            markLearned(indexPath: IndexPath(row: index + 1, section: 1))
        }
    }
    

        let cell = tableView.dequeueReusableCell(withIdentifier: studyCellId, for: indexPath) as! StudyCell
        
        cell.delegate = self
        
        let entry = viewModel.studyEntries.value[idx]
        
        cell.learnedButton.setTitle(entry.learned ? "✅" : "❓", for: .normal)
        cell.keywordLabel?.text = entry.keyword
        cell.entry = entry
        
        return cell
    }
    
