On July 18, delegates for the Republican Party gathered in Cleveland, Ohio, for the party’s 4-day national convention to nominate their candidate for president. Today, on July 25, Democratic Party delegates have convened in Philadelphia for the same purpose. Every four years the party conventions present financial and political opportunities for both the party and the host city, with multiple cities across the country vying for the opportunity. So how does the party go about choosing which city will play host?

The answer has evolved over the past several hundred years. Originally, the parties tended to stick with cities to which the delegates could most easily travel: In the early 1800s, parties frequently held their conventions in Baltimore, Maryland, a city about as close to the center of the country as one could get.

As the country expanded westward, the geographic calculus shifted along with it: In 1860, the Republican Party held their nominating convention in Chicago, despite the fact that the city had around only 110,000 people and did not have an arena large enough to house all the delegates (a temporary one was erected for the occasion). Since 1860, Chicago has been the site of a combined 25 conventions between the two major parties, more than any other city.

These days, with travel and technology making each convention more accessible, the parties have been able to include factors other than travel time into their decision-making.

The parties principally now weigh a given city and state’s potential value in their quest to alter the electoral map to that party’s advantage. This means parties holding their respective conventions in states that may be up for grabs in the fall election.

This phenomenon has played out predictably over the past few election cycles. In 2008, the Democratic Party held their convention in Denver, while their Republicans held theirs in St. Paul. Both states Colorado and Minnesota were seen as being in play during that election cycle.

Four years later, the Democrats held their convention in Charlotte, North Carolina, while the Republicans held theirs in Tampa, Florida. “We put the Democratic National Convention in Charlotte, North Carolina, in part because we believe so deeply in this map,” said Jim Messina, the campaign manager for President Obama’s reelection, in 2012, looking to keep North Carolina in the Democratic column after the state voted blue in 2008.

This year, the parties’ respective choices of Cleveland and Philadelphia reflect the volatility of both states: An average of general-election polls in Ohio — a perennial swing state — find the race between Clinton and Trump to be in the low single-digits; ditto for Pennsylvania, the polling average for which shows an almost identical split to Ohio.