Coffee is now generally believed to be a health-promoting beverage; the number of research papers in the last decade alone to bolster this claim has been astounding. But drinking coffee wasn’t always considered to be good for you. And there may actually be a scientific basis for that belief. A new analysis of coffee intake and ischemic heart disease (IHD) finds that in the past three decades, the relationship between the two has actually flipped, from a positive association (bad) to a negative one (good).

Published earlier this week in Scientific Reports, early observational studies trying to find an association between coffee and IHD—those performed before 1990—found that coffee was positively associated with an increased risk; drinking more coffee was showed to be associated with higher incidence of IHD. But as new studies came out, between 1990 and 2008, the findings began to shift from a positive association to none at all. Then more recently, as early as 2011, observational studies began showing a preventative association between coffee consumption and IHD incidence. To understand how the association has changed over time, the study’s authors “conducted a longitudinal ecological study using an international database with multiple coherent data.”

To this end, they examined coffee intake per capita as well as IHD mortality and incidence rates for 147 countries—each with a population over one million—between 1990 and 2018. Researchers accomplished this by crossing-referencing data from Global Burden of Disease Study 2019, which supplied information on every country’s “annual age-standardized” IHD mortality and incidence for the years between 1990 and 2018, with coffee intake information from the Global Dietary Database for the years, 1990, 1995, 2000, 2005, 2010, 2015, and 2018.

After accounting for covariates, other factors that may influence the results including things like a country’s GDP, aging rate (the percentage of the population that is 65 years old or older), energy intake via food, average alcohol consumption and smoking rates, and average physical activity, researchers found that globally, coffee consumption has trended upward while IHD incidence has gone down.

When parsing the data further, grouping countries into “super-regions” (South Asia; Latin America and Caribbean; North Africa and Middle East; Central Europe, Eastern Europe, and Central Asia; etc), the findings still held. As coffee consumption rose, IHD fell.

But still, the question remained: how was coffee ever positively associated with IHD in the first place? It’s not like coffee has substantively change, other than an increase in overall quality thanks to the rise of specialty coffee. In the paper, researchers suggest that the studies that came out pre-1990, the inflection point between positive and negative associations, may be due to “differing risks depending on how the coffee is brewed and confounding by cigarette smoking.” They posit that research in the late ‘80s and early ‘90s found differing health benefits between unfiltered and paper filtered coffee, which may have contributed to a shift around that time toward the more healthful paper filter. For smoking, the authors note that there was a “strong relationship” between drinking coffee and cigarette smoking and that older studies may not have accurately separated the two in order to find which was the contributing factor to higher IHD incidence (it was smoking).

So let this be a lesson to you: Be like coffee, never stop working on yourself. Maybe one day you too can all those positive (negative) things about yourself into negative (positive) ones.

Zac Cadwalader is the managing editor at Sprudge Media Network and a staff writer based in Dallas. Read more Zac Cadwalader on Sprudge.