For the large study involving 2,623 schoolchildren in Barcelona, researchers first assessed the amount of greenery around the children’s homes, along their commutes to school, and surrounding the schools themselves. They then measured the children’s working memories and attention spans using a series of word and number tests.

The children who had more vegetation around their schools showed more progress in working memory and attention over the course of a year, a finding that held true even after the authors controlled for socioeconomic status (the associations with the commute and home-based greenery were not as strong).

Not only did the plant life soak up much of the elemental carbon around the schools, the authors write, green spaces are also known to reduce city noise and stress while increasing opportunities for exercise.

More than half the world’s population lives in cities, so it’s not exactly practical for every child to attend school in the middle of a forest. Still, the results suggest that green space can be an important factor in designing school environments - and in drafting environmental regulations.

Olga Khazan is a staff writer at The Atlantic, where she covers health.