Obesity is one of the top lifestyle predictors for gallbladder issues according to research published in April 2012 in the journal Gut and Liver. “Obesity is a dominant factor in a person’s health and increases the risk of stone formation,” says Field Willingham, MD, associate professor of medicine in the division of digestive diseases at Emory University School of Medicine in Atlanta. If you’re overweight or obese, the best thing you can do for your health is to lose and maintain a healthy weight, he says. Here are four ways to help you stay fit to prevent your risk of developing gallstones:

1. Lose Weight Gradually, Not Rapidly

The most effective way to prevent gallstone disease in the long-term is to control one’s weight. But rapid weight loss, bariatric surgery, or participating in very-low-calorie diet programs (less than 800 calories per day), can actually increase the risk of developing gallstones, says Amit Joshi, MBBS, PhD, instructor of medicine in the clinical and translational epidemiology unit at Massachusetts General Hospital in Boston. Crash diets and rapid weight loss may increase the levels of cholesterol in the bile, which may lead to higher chances of developing cholesterol gallstones, Dr. Joshi says, so weight loss should be slow and steady, ideally. For people who are overweight or obese, the NIDDK recommends losing 5 to 10 percent of one’s body weight — a pound or two per week — over a six month period in order to reach an ideal body weight.

2. Eat Healthfully

Diet plays an important role in reducing gallbladder disease, but it’s not restricted to only eating fruits and veggies. Joshi says that eating a balanced mix of plant-based foods, such as nuts, fruits, vegetables, fiber, and foods with mono- or polyunsaturated fats, with grains and little to no red meat, can lower your risk of gallstone disease. A Mediterranean diet includes these foods and has been associated with reducing the risk of heart disease and “bad” cholesterol, which could build up and the body and lead to gallstones, according to the Mayo Clinic. Here are some tips for what types of food you should eat and what you should avoid:

Stick to healthy fats. Fat tends to get a bad rap, but not all fat is bad. The mono- and polyunsaturated fats found in olive oil, canola oil, and omega-3 fatty acids, which are found in avocados, canola, flaxseed, and fish, are beneficial in preventing gallstone disease. Healthy fats and fish oil may be especially beneficial to people with high levels of triglycerides, as it helps the gallbladder empty its contents regularly. But stay away from saturated fats found in fatty meats, butter, and other animal products, as these fats can increase your likelihood of developing gallstones and high cholesterol, among other health risks. Choose low-fat alternatives to red meat and whole milk, such as lean chicken, skim milk, and low-fat yogurt.Get fiber from fruits, vegetables, and nuts. Diets rich in fiber from whole-grain bread and cereals, fruits and vegetables, and plant sources of proteins, such as peanuts, walnuts, and legumes, help prevent gallstone disease. Snacking on almonds is a healthy way to ease hunger and help you lose weight.Avoid sugars and carbs. Sources of carbohydrates such as white bread, white pasta, and refined sugars may contribute to a higher risk of gallstone disease. Stay away from sweets and choose low-sugar food alternatives when possible.No need to shy away from coffee. You don’t have to give up your morning cup of Joe to prevent gallstones. In fact, a study published in 2015 in the journal Alimentary Pharmacology and Therapeutics found that coffee consumption significantly reduced the risk of gallstone disease, which may be due to the caffeine stimulating gallbladder contraction and the flow of bile.

3. Exercise

Regular physical activity can help reduce the chances of developing gallstones, Joshi says. And the intensity of the exercise doesn’t make much of a difference. A meta-analysis published in July 2016 in the Journal of Physical Activity and Health found that vigorous and nonvigorous physical activity were associated with a reduced risk of gallbladder disease. Guidelines from the U.S. Health and Human Services recommend that regular physical activity of at least 150 minutes per week, or 30 minutes five times a week, can improve health outcomes and prevent weight gain.

4. Take Preventative Medication

In individuals with a high risk of gallstone disease, such as those undergoing weight-loss surgery, Joshi says that drugs such as ursodiol (Actigall or Urso) can be used to prevent gallstone formation by dissolving them. Statins, or cholesterol lowering medicines, can also reduce the incidence of gallstone disease. Orlistat (Alli or Xenical), which is used to treat obesity, may help prevent gallstones during weight loss by reducing bile acids, which can contribute to gallstone formation. Gallstone problems can also be prevented by avoiding certain groups of cholesterol-lowering drugs and hormone replacement therapies, such as post-menopausal hormones or oral contraceptives. Some common triglyceride-lowering drugs, such as gemfibrozil (Lopid) and fenofibrate (Fibricor or Tricor), can actually increase the risk of gallstone disease because they may inhibit a liver enzyme and lead to increase in the levels of cholesterol in the bile. But statins are an effective way to lower cholesterol and triglycerides, so talk to your doctor about the best medication option for you if you need help controlling your cholesterol. Hormone or estrogen replacement therapy can increase a woman’s risk of developing gallstones because estrogen causes the body to make more cholesterol, Joshi says.