Some people crawl into bed, yawn like newborn kittens, pull the covers over their shoulders, and immediately drift off into uninterrupted sleep. Other people, like me, need a bit more coaxing. Almost every night, I turn off my lights, turn on my TV, and stream endless hours of New Girl reruns until Netflix saves me from myself. I don’t know exactly when this began or if it will ever end, but I refuse to drift into dreamland without Jess, Nick, Winston, and Schmidt lighting the way.

If you’re in the same boat, you might feel like your brain needs that technological nudge to fall asleep. But if you’re one of those people who sleeps while a streaming service cycles through episode after episode of some show, are you unintentionally damaging your rest?

To find out if it’s cool to nod off in front of a TV (or whichever device you’re watching), you need to understand how screens can affect your sleep. Let’s break down the two main ways screens mess with your sleep.

How light from your TV affects your sleep

Your body has an internal clock known as your circadian rhythm, which typically works on a 24-hour cycle and is controlled in large part by patterns of light and darkness, according to the National Institute of Neurological Disorders and Stroke (NINDS). As it gets dark, your brain’s hypothalamus kicks in to make you feel like it’s about time to pass the hell out. Enter melatonin, a hormone your brain’s pineal gland secretes that helps make you tired.