No particularly strong feelings, but I'd have done `if (primary.isPresent() && !seenPrimary)` rather than setting seenPrimary to true at the start if there isn't a primary.