I'm probably missing something, but shouldn't this be an "else if"? Otherwise it looks like a buried assumption that non-primary sections will never show up in the URL.