 nextFocusFilter;
    if (index < filters.length - 1) {
      nextFocusFilter = filters[index + 1];
    } else if (index > 0) {
      nextFocusFilter = filters[index - 1];
    }
    
    // Remove the filter
    filters.splice(index, 1);
    
    // Render and set focus
    renderFilterBadges();
    
    // If there are no filters left, focus the add button
    if (filters.length === 0) {
      addFilterBadge.focus();
      lastFocusedElementId = addFilterBadge.id;
    } 
    // Otherwise focus a related fi