Parade spoke to doctors and sleep experts to answer all our questions about melatonin and how it really works.

Though the hormone tends to function on a set day/night schedule, it’s greatly affected by light. If you’re exposed to light, even at midnight, your brain will stop producing melatonin. Whether you’re enjoying the sun at noon or checking Instagram in bed, they both have about the same effect on the hormone.

Scientists still aren’t sure exactly how melatonin affects sleep, but there seems to be a fairly solid connection. “Though melatonin is not essential for sleep, we tend to sleep better when it is secreted,” Kouri says.