                     break
                 }
             default:
-                let lastRow = self.tableView.numberOfRows(inSection: indexPath.section) - 1
-
-                // Delete category button
-                if indexPath.row == lastRow && self.existingCustomCategory {
-                    self.onDeleteCategory()
-                }
                 break
+            }
+        case Section.deleteCategory.rawValue:
+            if self.existingCustomCategory {
+                self.onDeleteCategory()
             }
         default:
             break


                return cell
            }
        default:
            return SCTableViewCell()
        }

// MARK: UITableViewDelegate, UITableViewDataSource
extension SCCustomCategoryModalViewController: UITableViewDataSource, UITableViewDelegate {
    func numberOfSections(in tableView: UITableView) -> Int {
        return sectionLabels.count + 1  // Account for delete category section
    }

    func tableView(_ tableView: UITableView,
                   heightForHeaderInSection section: Int) -> CGFloat {
        if section == Section.deleteCategory.rawValue {
            return 0.0
        }

        return 44.0
    }

