If you don’t think that the troubling trend of global warming could impact your sweet tooth, think again. Farmers of the cacao plant — responsible for the oh-so-addicting chocolate that we all know and love — are warning that higher temperatures and the dryer climates that come with them are having a devastating effect on their crops, and scientists now forecast that cacao harvests could be completely wiped out within just a few decades if nothing is done.

Thankfully, researchers from the University of California are working on tweaking the DNA of cacao plants in the hopes of making them more hearty, allowing them to withstand the shifting climate, warmer temperatures, and shortages of water.

Cacao is a somewhat moody plant, only thriving in a few remote areas of the planet, and it doesn’t do very well in unpredictable climates. The regions where chocolate companies source most of their cacao are expected to grow more and more hostile to the plant over the next few decades, which will force farmers to look elsewhere unless something can be done.

With the help of Mars — the company behind some of the world’s most popular chocolate products, including Snickers — University of California researchers are using the gene-editing technology CRISPR to produce new cacao plants which will thrive even when current farmland becomes drier and warmer than ever before. This will allow farmers to continue raising their crops without forcing them to look for new plots of land at higher elevations where the climate is more welcoming.

You’ve likely heard of CRISPR before, and likely in a negative context. The technology allows the modification of DNA that some scientists fear will result in humans seeking to modify themselves or their offspring. A recent study revealed that geneticists have been attempting to tweak the DNA of pigs in order to make them more resistant to cold. By altering some of the genes related to body temperature regulation, the pigs gained faster metabolisms which would theoretically help them fight off cold weather.

Work with the cacao plant is still ongoing, and researchers still have some time to get it right, but if they fall short we may see a future where chocolate becomes more rare and pricey than it’s ever been.