For those trying to lower their carb intake, beloved pasta is often one of the first dishes to be cut from diets. But not all pasta is created equal, according to a new study published in Nutrition & Diabetes. Turns out those heavy cream-laden meals at Italian restaurants are quite different from the simpler variety paired with other foods regularly consumed as part of a Mediterranean diet. So in that vein, eating noodles may actually be quite healthy for you.

In recent years, pasta has gained a reputation of being unhealthy, fattening, and a little too carb-y for weight loss. Even in Italy, a country famous for its spaghettis and carbonaras, noodle consumption has decreased, thanks to new evidence that links low carbohydrate and high protein diets to obesity. But it turns out that eating pasta in moderation may actually help fight obesity and shrink your waistline.

In the study, the researchers examined pasta consumption in comparison to body mass index (BMI) and waist-to-hip ratio. They focused on two groups of participants: The first involved 14,402 people aged 35 or older, who lived in the Molise region in Italy, and the second consisted of 8,964 people aged 18 or older from all over the country. They found that people who ate decent amounts of pasta (but not too much) had a lower BMI.

They also found that people who ate more pasta tended to consume more foods associated with the Mediterranean diet in general, suggesting that pasta eaters often pair it with healthy items. “Among food groups included in [the Mediterranean diet], cooked tomatoes and other sauces were strongly correlated with pasta consumption in both women and men,” the researchers wrote. “Other food groups included… with strong correlations of pasta intake in both genders were onions and garlic, olive oil, seasoned cheese and rice.”

The Mediterranean diet is well-known for its beneficial effects on our health, from improving our cognitive function to protecting against heart disease. And apparently, it isn’t afraid of healthy grains, as some pasta dishes are, or fatty foods like olive oil and salmon.

Pasta is indeed a carbohydrate, but in moderation, it can be a good type of carb. Carbs are found in many foods, and they are one of the body’s main sources of energy. There are two types: simple (anything that mainly consists of sugar, like soda or cake) and complex (fruits, vegetables, whole grains, and legumes). Complex carbohydrates are made up of sugar, but they’re also high in fiber and starch, which can improve digestive health and help with weight loss.

When choosing carbs, it’s always better to go with ones that are complex rather than simple. If you’re sticking with pasta, whole grain noodles are packed with fiber and even some protein, calcium, and potassium, and contain no cholesterol. But perhaps most importantly, make sure you’re keeping an eye on carb intake rather than overeating or cutting them out completely.

Source: Pounis G, Castelnuovo A, Costanzo S, Persichillo M, Bonaccio M, Bonanni A. Association of pasta consumption with body mass index and waist-to-hip ratio: results from Moli-sani and INHES studies. Nutrition & Diabetes, 2016.