     func classObj(at indexPath: IndexPath) -> Class {
         if isSearchActive {
             return filteredClasses[indexPath.row]
-        } else if favoritedClasses.count > 0 && indexPath.section == 0 {
+        } else if indexPath.section == 0 {
             return favoritedClasses[indexPath.row]
-        } else if favoritedClasses.count > 0 && indexPath.section != 0 {
+        } else {
             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 1
        } else {
            // Add a section if there are any favorited classes
            return favoritedClasses.count > 0 ? classesBySection.count + 1 : classesBySection.count
        }
    }


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