 
 
     func incidentForTableRow(rowIndex: Int) throws -> Incident {
+        let viewableIncidents = self.viewableIncidents
+
         guard rowIndex >= 0 else {
             throw DispatchQueueTableSourceError.RowIndexOutOfRange(rowIndex)
         }
         
-        guard rowIndex <= viewableIncidents.count else {
+        guard rowIndex < viewableIncidents.count else {
             throw DispatchQueueTableSourceError.RowIndexOutOfRange(rowIndex)
         }
 

    }


    var viewableIncidents: [Incident] {
        guard let stateFilterPopUp = stateFilterPopUp else {
            logError("No state filter popup?")
            return []
        }
        
        let selected = stateFilterPopUp.selectedTag()
        
        guard let filterTag = StateFilterTag(rawValue: selected) else {
            logError("Unknown filter tag: \(selected)")
            return []
        }
        
        let filteredIncidents: [Incident]
        
        switch filterTag {
            case .All   : filteredIncidents = filteredIncidentsCache.allIncidents
            case .Open  : filteredIncidents = filteredIncidentsCache.openIncidents
            case .Active: filteredIncidents = filteredIncidentsCache.activeIncidents
        }

        return searchIncidents(filteredIncidents)
    }


    @IBAction func updateViewedIncidents(sender: AnyObject?) {
        if let dispatchTable = self.dispatchTable {
            // Make sure UI stuff goes to the main thread

    // Not NSTableViewDataSource, but related


    func searchIncidents(incidents incidents: [Incident], searchText: String) -> [Incident] {
        let searchText = self.searchText

        if searchText.characters.count == 0 {
