Political analysts are spending this post-election morning prognosticating all-out armageddon for the Republican Party. And while last night was a rough one for the GOP, there are distinct and sober reasons why Roy Moore lost his chance at a Senate seat to Democrat Doug Jones—mostly to do with Moore and his Alabama opponent’s ground game—as well as some key lessons for the GOP going forward. Here’s what we should be considering:

1. Shelby was the ballgame. Alabama Republican Senator Richard Shelby’s expression of opposition to Republican Roy Moore in the last days of the election was critical. It gave thousands of cross-pressured Republican voters a reason not to vote for their party’s nominee.

2. Candidates matter. The Alabama race was more of a personal defeat for Moore, a uniquely controversial candidate, than it was a general defeat for the Republican Party. You can’t discuss slavery in a favorable light, as Moore did, and not expect a backlash. You can’t expect to win an election when you criticize provisions of the U.S. Constitution that abolished slavery, guaranteed due process and equal protection, and gave women the right to vote. Being cast as a “pedophile” who was thrown out of a shopping mall is also not the best positioning for an aspiring officeholder.

3. President Trump’s lack of coattails is a danger sign for Republicans in red-state Senate races next year. Trump won Alabama by a massive 28 points. But the Alabama Senate candidates he endorsed in both the Republican primary (Luther Strange) and the general election (Moore) both lost. This gives incumbent Democratic senators seeking re-election in states that Trump carried by big margins in 2016 (Missouri, West Virginia, Montana, Indiana, and North Dakota) new hope that they can overcome pro-Trump sentiment and win. If all or most of those five Democratic senators are re-elected, the GOP’s Senate majority will be at serious risk.

4. Sexual harassment issues matter. Polls show that the reputations of national celebrities (i.e. Charlie Rose, Matt Lauer, Al Franken) don’t survive accusations of sexual misconduct. This issue knocked Moore’s campaign off-track at a critical time, and made it difficult for many of his fellow Republicans to support him.

5. TV ads matter. There were 10 times as many TV ads run for Democrat Doug Jones than for Moore. While commercials were only one element of the pro-Jones campaign, it isn’t likely Jones could have won without his overwhelming dominance of this medium.

6. The ground game matters. Jones could not have won without a big turnout of black voters. His campaign understood this, and made the effort required.

7. Be careful which polls you believe. Public polls are increasingly all over the place in state elections. Some are right, but enough are off the mark to make poll reading very confusing. We saw that in 2016, and we saw it again in Alabama where one of the three final polls showed Moore ahead by nine points (Emerson College), one had the race tied (Monmouth University), and one put Jones ahead by 10 points (Fox News).

Ron Faucheux is a nonpartisan political analyst and publisher of LunchtimePolitics.com, a free daily newsletter on polls.