It’s official: healthy vending machines are making inroads in the obesity epidemic among U.S. schoolchildren.

In August 2012, the journal Pediatrics published a study tracking 6,300 schoolchildren in 40 states. Their height and weight were recorded in 2004, when the kids were fifth-graders. The next weigh-in was in 2007, in eighth grade.

In states without laws promoting healthy school vending machines, there was little change in the number of overweight test-subjects.

It was a different story for kids who lived in states mandating healthy vending machines. About 21 percent of those test-subjects classified as obese — not just overweight — at the start of the study. Three years later, the rate dropped to 18 percent.

The drop in the number of overweight test subjects was even more impressive — once again, in states requiring healthy vending machines in schools. In those states, 39 percent of fifth graders were overweight in 2004. By eighth grade, five percent of them had trimmed down to fit weights.

“This is the first real evidence that the laws are likely to have an impact,” says Dr. Virginia Stallings of the nutrition center at Children’s Hospital of Philadelphia.

Health experts have long worried about childhood obesity. More than one third of U.S. schoolchildren are overweight today. That’s triple the percentage 30 years ago. Even worse, the Centers for Disease Control and Prevention say almost 20 percent of kids in elementary school are obese.

But healthy vending machines are popping up in more states. So now, schoolchildren can snack on roasted edamame beans instead of greasy chips, fruit juice instead of sugar-loaded sodas.