The long black pruning poles looked cumbersome. But the farmers moved quickly, swarming over the small plot of land and hoisting the poles up to slice through cacao branches with ease. On the bottom end of the pole was a small gasoline engine; on the top, a chain saw. Buzzing sounds mixed with the humming of insects echoing through this corner of the Ecuadorian Amazon. Though it was early spring, the October heat already felt solid and oppressive as the workers, in jeans, long-sleeved orange tops, hard hats, and plastic face shields, strode through the jungle, chickens scrambling to get out of their way.

Farmers in this community were skeptical at first, but pruning the branches at the start of the season can increase the cocoa yield—sometimes dramatically. The tree produces more fruit on the branches that remain. “Also, by taking away unproductive branches, we limit or eliminate plagues or diseases,” Ricardo Zapata, a coordinator for the cacao-pruning initiative in Ecuador, told me. It’s one of several innovations experts say could make an infamously environmentally destructive crop more sustainable.

Chocolate has gotten a bad rap for its environmental impacts—particularly deforestation, as farmers cut down older trees in order to clear room for cacao plants. The Ivory Coast, which is the largest exporter of cocoa at 2.2 million tons every year, has lost 80 percent of its forests in the past five decades. And the forests being cleared for cacao farming are exactly the ones that tend to be the best carbon sinks and sources of biodiversity: Cacao trees thrive in rain forests, where there’s plenty of humidity and rain, stable temperatures, rich soil, and protection from strong winds. All of this combines to make chocolate one of the worst foods one can eat in terms of greenhouse gas emissions—by some calculations, the single worst nonmeat food.

The problem has proven tough to solve at scale. In October, The Washington Post published a feature exploring why, 10 years after pledging a switch to 100 percent sustainable cocoa, candy giant Mars Inc., which sources mainly from West Africa, is far from realizing that dream. Certification schemes are unreliable in an industry dominated by thousands of smallholder farmers, often in countries with uneven governmental regulation or infrastructure.

But experts also say that small and surprisingly simple steps can drastically increase sustainability. The Ecuadorian focus on pruning cacao trees, which I saw in 2015, aimed to help farmers make the most of what they already had—so they wouldn’t need to press further into the Amazon. Among other sustainable techniques are shade-growing and multicropping, as well as the correct use of fertilizer and pesticides—including natural pest control and compost.