                 return
         }
         
-        var indexPath: IndexPath
-        
-        if favoritedClasses.count > 0 {
-            indexPath = IndexPath(row: row, section: section + 1)
-        } else {
-            indexPath = IndexPath(row: row, section: section)
-        }
+        let indexPath: IndexPath = IndexPath(row: row, section: section + 1)
+        
         self.tableView.beginUpdates()
         self.tableView.insertRows(at: [indexPath], with: .automatic)
         self.tableView.reloadSections(IndexSet.init(integer: indexPath.section), with: .automatic)

    func classObj(at indexPath: IndexPath) -> Class {
        if isSearchActive {
            return filteredClasses[indexPath.row]
        } else if favoritedClasses.count > 0 && indexPath.section == 0 {
            return favoritedClasses[indexPath.row]
        } else if favoritedClasses.count > 0 && indexPath.section != 0 {
            return classesBySection[indexPath.section - 1][indexPath.row]
        } else {
            return classesBySection[indexPath.section][indexPath.row]
        }
    }
    
    /// Updates the tableview to the filtered classes array user searched for

        if isSearchActive {
            return 0
        } else {
            if section == 0 {
                return favoritedClasses.count > 0 ? 44 : 0
            } else  {
                return classesBySection[section - 1].count > 0 ? 44 : 0
            }
        }
    }
