Living in a city is great because there are always tons of things to do within walking (or public transport) distance and, as a result, it’s easy to be constantly active and burning calories. But with city life comes more stress and more pollution, which can negatively affect your health.

Switch to the suburbs and all of that necessary driving around in the car to get to any sort of amenity can seriously put a dent in your cardiovascular health. And while rural types have more space to stretch out and their own lawns to enjoy, the isolation and lack of community can affect your social health. What to do?

Well, recent research from the University of Arizona’s Udall Center for Studies in Public Policy took a look at how constructed environments like neighborhoods can detract or enhance your overall health and found that where you live can affect you in varied ways. For the study, researchers investigated four different types of neighborhood designs—"traditional development," "suburban development," "enclosed community," and "cluster housing development"—and compared them to a “walkability model” that examines neighborhood connectivity, land use, density, traffic safety, surveillance, parking, resident experience, green space, and community of each environment.

The researchers found that in the traditional neighborhood—typically 1940s-style compact housing within walking distance to commercial areas—people did the most walking, but also had lower levels of mental health and thought about crime the most. In the suburbs—single-family houses in subdivisions where there's more nature but not many amenities—the residents had better rates of mental well-being. For the enclosed (aka gated) communities, people didn’t feel any safer from crime by being sequestered away from society. And those in cluster housing, which is kind of a mix of traditional and suburban, had the most social interaction with neighbors and felt the safest.

Learning how to create sustainable and healthy communities will become more vital as communities expand, since most people live in cities now and that will probably stay the same into the future, said study lead Adriana Zuniga-Teran, a post-doc at the university. “Cities are going to grow more than rural areas, and we are going to become an urbanized world, so understanding how to improve life in cities is very important.”

One notable conclusion: Trees seem to be a big part of the making communities more livable. Future research will look at how planting trees and landscaping, mostly in low-income areas, can impact the area’s health. “The presence of trees was related to a higher perception of safety and people interacting more with their neighbors," she wrote. "Trees seem to bring a lot of benefits, and I would like to study the effect of planting trees in the most walkable design—a traditional development—because that could be a really direct strategy to improve well-being,” she said.