There was a time—and it wasn’t that long ago—when national health authorities thought coffee was bad news for your brain and body. In particular, the American Heart Association once listed coffee as a problem habit people should avoid in order to protect their tickers. Times have changed. More and more research now shows drinking coffee could safeguard you from multiple serious health conditions—including heart disease.

Here’s what you need know about coffee’s benefits, and how much of the stuff you should be drinking.

Drinking a few cups of caffeinated joe every day may lower the amount of calcium buildup in the arteries of your heart, concludes a 2015 study from the journal BMJ Heart. The more artery calcium accumulates, the greater your risk for a heart attack. And people who drink 3 to 4 eight-ounce cups of coffee a day have 41% less of that heart gunk, says Eliseo Guallar, M.D., who co-authored the study. Guallar says the antioxidants in caffeinated coffee may promote cell health, which would help explain the lower amounts of arterial calcium among drinkers.

People who drink two or more cups of java a day are 44% less likely to develop advanced forms of colon cancer, finds a study in the journal Nutrition and Cancer. More research has linked coffee consumption to better survival rates among people who do get colon cancer. (And that’s a lot of us: 1 in 20 people develop this form of cancer at some point in their lifetime, according to the American Cancer Society.) Apart from triggering bowel movements, coffee also seems to settle down the sorts of blood-sugar swings linked to the development of colon cancer, the study authors say. More research ties coffee consumption to lower rates of some skin cancers, liver cancer, and other forms of the disease.

The same blood-sugar benefits mentioned above could play a role in your risk for diabetes. A study from Harvard linked moderate coffee consumption to an 11% drop in a person’s type-2 diabetes risk. Yet another Harvard study linked coffee consumption to lower rates of depression, though the authors don’t know how to explain that finding.

People who drink 3 to 5 cups of coffee a day enjoy mortality rates 15% lower than those who don’t drink java, according to a recent Harvard School of Public Health study. (People who drank more or less than that were still better off than the non-drinkers.) The Harvard study team says any one of the 1,000 compounds found in coffee could explain the drink’s benefits, but more research is needed to figure out just what’s so healthy about your morning joe.

The more caffeinated coffee you drink—up to three cups a day—the lower your risk for developing Parkinson’s disease, finds new research from China. The study team found similar benefits among those who drank caffeinated tea. Because of this, they believe it’s the caffeine in these beverages that somehow protects your brain from the disease—though the specifics of how caffeine does this are unclear. More study has linked mild to moderate coffee consumption—again, no more than 3 or 4 cups—to lower rates of late-life brain diseases like Alzheimer’s.

We could go on and on here. But the big takeaway is that coffee—more so the fully leaded stuff, not decaf—is a healthy addition to your daily routine. But there are some big caveats.

For one thing, all of these studies are based on black filter-brewed coffee. If you’re dumping sugar or cream into your morning cup, those unhealthy additives aren’t going to do you any favors. Also, some research suggests French press brewing and some other unfiltered prep methods allow not-so-healthy oils and compounds into your brew. So you’re better off drinking plain old black java.

Finally, experts say every one responds differently to coffee. If your heart races or you can’t get to sleep at night, you need to cut down or avoid drinking coffee in the afternoon or evening hours. Like any other stimulant, your body needs time to build up tolerance to caffeine, experts warn. So if you’ve never been a coffee drinker, trying to guzzle 24 to 32 ounces right off the bat isn’t a good idea.