What’s keeping us from getting that oh-so-optimal 8 hours of sleep a night?

We all know that a good night’s rest is vital to overall health, but we may not realize how essential it is or try hard enough to get it.

After all, a rough night can easily be “erased” by guzzling a good cup of coffee in the morning, right?

Maybe not.

Prioritizing sleep and finding solutions if you’re not getting enough is smart if you want to maintain optimal health.

“Sleep is a time that evolution has allotted for the brain and body to perform needed functions that either can’t be done while we’re awake or that are more optimally done during an ‘off-line’ state,” Dr. Robert Stickgold, PhD, an associate professor at Harvard Medical School’s Center for Sleep and Cognition, told Healthline.

Read More: Lack of Sleep Can Lead to Overeating, Poor Food Choices »

A new study that will be presented at the American Academy of Neurology’s 68th annual meeting next month correlates poor sleep to street lights.

The study examined nearly 16,000 people and used data to connect poor sleep to locations with more intense radiance.

Sure enough, in cities and urban areas with more nighttime light, people reported a poorer quality of sleep. Those living in urban areas of 500,000 people or more were exposed to nighttime light that was three to six times more intense than those in rural areas and small towns.

This light, also known as blue light, isn’t all bad. It assists our circadian clocks for proper function and assists in plant growth. In animals, it helps with migration, mood, metabolism, and immunity.

Dr. Maurice Ohayon, PhD, a Stanford University professor who authored the study told Healthline that most people know lights can contribute to poor sleep. His research was the first, however, to confirm that poor sleep can be linked to areas with high levels of nighttime lighting.

Of those living in areas with more intense lighting, 29 percent were dissatisfied with their sleep and 9 percent reported fatigue, while just 16 percent of those in lower-lit areas were dissatisfied with their sleep and 7 percent experienced fatigue.

Those in urban areas had an average of 402 minutes of sleep per night, compared to rural dwellers getting an average of 412 minutes a night in low-lit areas. And 19 percent of urbanites were more likely to wake up confused at night compared to 13 percent of rural area residents.

“Light pollution can be found in any sizable city in the world. Yet, excessive exposure to light at night may affect how we function during the day and increase the risks of excessive sleepiness,” Ohayon said. “If this association is confirmed by other studies, people may want to consider room darkening shades, sleep masks or other options to reduce their exposure.”

Ohayon added that people should turn off electronic devices while sleeping or trying to get to sleep.

Read More: Can Technology Really Help You Sleep Better? »

Street light radiance isn’t the only culprit. Other sources of blue light from computers, televisions, or other electronic devices could be impairing your ability to sleep.

“As a society, we are using more technology, and there’s increasing evidence that artificial light has had a negative consequence on our health,” Brian Zoltowski, PhD, an assistant professor at Southern Methodist University in Dallas, said in a statement.

He conducted research in 2014 that reported how light impacts chemical signals in our bodies. The interruptions can affect sleep, metabolism, cancer development, drug addiction, and mood disorders, to name a few.

Light may not be the only thing keeping us up.

Many people aren’t aware that they need more rest than they may be getting — and many think caffeine can replace sleep. Plus, more people are working at home, which can fail to offer a separation between activities of work and rest.

Shift workers, who often work outside the traditional 9-to-5 window, are also prone to sleep interruptions.

Being hyper-connected and always wanting to check messages are other factors that can keep us up. And don’t forget the Sunday Night Blues or Sunday Night Syndrome — that sinking feeling that a new workweek is looming. That may not be doing much in the way of helping you rest.

Read More: Stimulant Medication May Make ADHD Children’s Sleep Problems Worse »

Stickgold said new research has concluded that sleep is essential for proper immune and endocrine function.

“We can’t produce normal amounts of antibodies without sleep, and glucose regulation goes out of kilter even with reduced sleep, making individuals look pre-diabetic,” he said.

Sleep plays a major role in memory processing, determining which memories will be remembered and forgotten. Stickgold said inadequate sleep can contribute to a wide range of psychiatric disorders, including ADHD, depression, PTSD, and schizophrenia.

A study published this week in SLEEPuncovered the mechanism that links poor or inadequate sleep with overeating, poor food choices, and gaining weight.

The National Sleep Foundation offers a guide to help people determine how much sleep they need. For most adults, it’s between seven to nine hours per night.

March 6 -13 is Sleep Awareness Week as designated by the National Sleep Foundation.