     }
     
     override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return self.noteDocuments.count
+        return self.searchController.isActive && self.searchController.searchBar.text != "" ? self.filteredNoteDocuments.count : self.noteDocuments.count
     }
     
     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let cell = tableView.dequeueReusableCell(withIdentifier: "NotesTableViewCell", for: indexPath) as! NotesTableViewCell
         
-        let noteDocument = self.noteDocuments[indexPath.row]
+        let noteDocument = self.searchController.isActive && self.searchController.searchBar.text != "" ? self.filteredNoteDocuments[indexPath.row] : self.noteDocuments[indexPath.row]
         
         cell.noteLabel.text = noteDocument.note.entry
         cell.noteModificationTimeStampLabel.text = noteDocument.note.dateModificationTimeStamp

    }
    
    fileprivate func setupSearchBar() {
        //        self.searchController.searchResultsUpdater = self
        self.searchController.hidesNavigationBarDuringPresentation = false
        self.searchController.dimsBackgroundDuringPresentation = false
        

            guard let validNotesViewController = segue.destination as? NotesViewController,
                let selectedNoteCell = sender as? NotesTableViewCell,
                let selectedIndexPath = self.tableView.indexPath(for: selectedNoteCell) else { return }
            let selectedNote = self.searchController.isActive && self.searchController.searchBar.text != "" ? self.filteredNoteDocuments[selectedIndexPath.row].note : self.noteDocuments[selectedIndexPath.row].note
            validNotesViewController.note = selectedNote
        case .segueToNotesViewControllerFromAddButton:
            print("adding new note")
