how do primaries work