For a good night’s rest, keep the smartphone out of the bedroom and refined carbs off your dinner plate.

Researchers analyzed information from food diaries kept by more than 53,000 older women involved in the ongoing Women’s Health Initiative Observational Study. The scientists found that women who ate larger amounts of high-glycemic refined carbohydrates—like white pasta and sugary desserts—were more likely to develop insomnia. The findings, reported in The American Journal of Clinical Nutrition, showed that consuming more whole grains, fiber, vegetables and whole fruit was associated with fewer insomnia problems.

When blood sugar is raised quickly by eating highly processed carbs, there’s a subsequent insulin-induced drop in blood sugar. That can lead to the release of stress hormones such as cortisol, which may interfere with a good snooze.