     }
     
     private func getPasswordEntry(by indexPath: IndexPath) -> PasswordsTableEntry {
-        var entry: PasswordsTableEntry
-        let index = sections[indexPath.section].index + indexPath.row
-        if searchController.isActive && searchController.searchBar.text != "" {
-            entry = filteredPasswordsTableEntries[index]
-        } else {
-            entry = passwordsTableEntries[index]
-        }
-        return entry
+        return sections[indexPath.section].entries[indexPath.row]
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

import SwiftyUserDefaults
import PasscodeLock

enum PasswordsTableEntryType {
    case password, dir
}

struct PasswordsTableEntry {
    var title: String
    var isDir: Bool
    var passwordEntity: PasswordEntity?
}

class PasswordsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UITabBarControllerDelegate {

    }
    
    private func generateSections(item: [PasswordsTableEntry]) {
        let collation = UILocalizedIndexedCollation.current()
        let sectionTitles = collation.sectionIndexTitles
        var newSections = [(title: String, entries: [PasswordsTableEntry])]()
        
        // initialize all sections
        for i in 0..<sectionTitles.count {
            newSections.append((title: sectionTitles[i], entries: [PasswordsTableEntry]()))
        }
        
        // put entries into sections
        for entry in item {
            let sectionNumber = collation.section(for: entry, collationStringSelector: #selector(getter: PasswordsTableEntry.title))
            newSections[sectionNumber].entries.append(entry)
        }
        
        // sort each list and set sectionTitles
        for i in 0..<sectionTitles.count {
            let entriesToSort = newSections[i].entries
            let sortedEntries = collation.sortedArray(from: entriesToSort, collationStringSelector: #selector(getter: PasswordsTableEntry.title))
            newSections[i].entries = sortedEntries as! [PasswordsTableEntry]
        }
        
        // only keep non-empty sections
        sections = newSections.filter {$0.entries.count > 0}
    }
    
    func actOnSearchNotification() {
