Americans’ attitudes towards legalization of marijuana have changed over the decades, and Marketwatch posits that the reason for it is not as straightforward as you might think (assuming you think it stems from legalization across various states). Rather, they believe it’s positive media coverage that has changed the country’s mind.

Three decades ago (in 1988, to be specific), a poll revealed that only 24 percent of Americans supported legalization of cannabis. Several things have happened since then, the most obvious being the fact that 33 states have legalized marijuana in some form or another, according to Governing.com. That figure includes ten states which have legalized pot for recreational use, rather than strictly medical use.

Of course, marijuana remains illegal at the federal level. At the time of writing, the feds’ policy (since the Obama administration) has been to look the other way, so long as the states in question make every effort to keep pot out of the hands of kids.

The conventional wisdom, then, would be that state-level legalization has been the reason that Americans’ attitudes have changed. However, Marketwatch looked deeply into the data — specifically at states in which pot has been legalized in one form or another — and compared the numbers to those of border states that don’t have any legislation that legalizes pot (e.g. Colorado and Nebraska). And as it turned out, the polling results, over the decades, largely mirrored each other in now-legal states, still-illegal neighboring states, and the country at large.

Other possible factors were also considered. For example, older Americans, who traditionally skew more conservative, are dying off and being replaced by younger Americans. However, it made no difference: the voters’ attitudes towards pot have been largely the same across all age groups.

The real reason — or main reason, anyway — for the change in Americans’ views on marijuana legalization is how the media portrays the plant.

Looking back to the ’80s, the media largely portrayed pot in one of two ways: it was either a joke (Cheech & Chong) or as no less an evil bugaboo than crack or heroin.

However, that all began to change, gradually, beginning in the ’90s. Looking at The New York Times as a benchmark for marijuana-related reporting, Marketwatch researchers parsed out the numbers on how the paper reported pot-related stories. In the ’80s, almost all NYT stories related to cannabis were negative — looking at it in the context of criminal acts — with only a minuscule handful reporting on marijuana as it relates to medicine.

Beginning in the ’90s, the Times began reporting more earnestly on marijuana in a medical context. Perhaps not coincidentally, it was in the ’90s that California legalized medical marijuana. By 2016, roughly 26 percent of Times reporting about marijuana reported about the plant in a medical context.

Of course, the Times is not the only newspaper in America, nor do all Americans read it. But Marketwatch writer Amy Adamczyk notes that a rough sampling of other major papers reveals similar trends outside of New York.

To be fair, media coverage hasn’t been the only factor in Americans’ changing views towards marijuana legalization. Reagan-era laws and sentencing guidelines have led to mass incarceration of young men for minor pot offenses. What’s more, the War on Drugs and mass incarceration have disproportionately affected blacks and Latinos, and Americans are realizing that there has to be a better way.

So does this mean that federal marijuana legalization is on the way? Or that all 50 states will legalize cannabis, federal law notwithstanding? Hard to say, says Adamczyk.