Here’s how my nights have traditionally gone (raise your hand if this sounds familiar): Sometime late in the evening, I would look at the clock and think that I should go to bed. I’d procrastinate for a couple hours before realizing that I really needed to get some sleep. Once in bed, I’d spend the next hour or so trying to fall asleep. I’d eventually do so, and then I’d drag myself out of bed a few hours later.

I’ve been sleeping like this—badly, that is—for years now, but I recently decided that things had to change. Maybe it was because I read one too many scary articles about the dangers of sleep deprivation, maybe it was because I wanted the great benefits of sleep, or maybe it was just because I was tired of feeling tired.

Once I decided I wanted to sleep better, I researched how I could make it happen. I chose the tips that seemed the most helpful and put them into action—and then I got the best night’s sleep ever. Here’s how I changed my nights for the better, and how you can, too.

1. Setting aside enough time for sleep

The National Sleep Foundation recommends that adults get seven to nine hours of sleep each night, but 40% of Americans don’t get even seven hours. Until recently, I might have gotten that much after sleeping in on a weekend, but almost never on a weeknight.

It’s not that I didn’t have the time, but that I chose to use the time to do other things. Some of those activities were important (cleaning, spending time with friends), others were less so (the internet), but I realized that getting enough sleep was more important than any of them. I decided I wanted seven hours of sleep each night, and I set a bedtime accordingly. As it turns out, getting enough sleep really does make me feel less tired.

2. Turning off my electronics an hour before bedtime

Once I set my bedtime, I committed to stop using electronic devices an hour beforehand—no phone, no TV, and no computer. Science says that electronics emit blue light that keeps us wakeful and alert, making it harder to sleep. Experts recommend keeping electronics out of the bedroom and limiting your use of them before bedtime.

Science aside, I know I get caught up in my internet activities. Disconnecting from my devices made it much easier to go to bed when I said I would—no excuses for finishing this episode. I use my hour before bed to do more reading (physical books only, since studies show that paper books help you fall asleep faster than ebooks). It makes sticking to bedtime easier than I thought possible.

3. Blocking out the world with white noise

I was worried that all my planning wouldn’t help once I actually laid down, if only because outside noise has been known to keep me up at night. It seems inescapable—whether it’s traffic, noisy neighbors, or even your partner's snoring. There’s always some noise that keeps you from getting deep, restful sleep.

Enter white noise. Research shows that using white or pink noise to mask other sounds can promote quality rest. The idea is simple: soothing white noise won’t keep you awake, and it will block out the sounds that would. It works! I slept solidly, undisturbed by the noises that usually woke me. I used a white noise machine, but there are plenty of white noise apps for your phone, and some people swear by just using a fan.

4. Replacing my tired old mattress

While most of my changes required little in the way of time or money, after taking a hard look at my mattress, I decided it could be making my sleep worse. It wasn’t a new mattress by any means, I tossed and turned at night, and I didn’t even think my mattress was particularly comfortable.

While finding a new bed was daunting at first (there are so many choices out there!), it turns out that mattress shopping isn’t that hard. I was able to find a bed in my budget that I really like. I’m excited to lay down on it at night, and I don’t toss and turn like I used to. I never thought I’d look forward to bedtime so much.

5. Lowering my thermostat at night

I’ll confess: this was the hardest change to make. I hated the thought of waking up to a cold room in the morning and having to force myself out of my warm bed. Still, experts suggest that sleeping at a slightly lower temperature can improve your rest, so I reluctantly tried it. I figured that better sleep (and a cheaper utility bill) was worth it.

And it was! I slept solidly all night, cozy in my warm bed even though the room was cool. Getting out of bed in the morning wasn’t as hard as I thought it would be, probably because I felt better-rested than ever before. I’ve been manually lowering my thermostat at night, but programming a smart thermostat would make it even easier to get better sleep.

I thought I was just bad at sleeping, but it turned out I just needed to change how I approached my nights. I’m more rested than ever, and I’m reaping the benefits. Want to say the same? Try these ideas for yourself, and get ready for the best night’s sleep you’ve ever had!