Having habits can often be a good thing. When you drive to work for example, you don’t need to wonder whether you should turn left or right; the route becomes habit.

“We want the brain to learn how to do those things without energy and effort,” says Russell Poldrack, a professor of psychology at Stanford University. “Habits are an adaptive feature of how the brain works.”

But sometimes, habits can lead us astray—whether it’s turning to comfort food when we’re sad, or taking a cigarette break when stressed.

Since habits take practice and repetition to form, the same is true when it comes to breaking them, says Elliot Berkman, director of the University of Oregon’s Social and Affective Neuroscience Lab. In order to eliminate those pesky habits—whatever they may be—start with these five strategies.

Sink your stress levels

Many habits—including smoking or excess sugar consumption—involve the brain’s dopamine (or reward) system. Dopamine is a “feel-good” chemical that transmits signals between neurons in the brain. The first time you engage in a new, “rewarding” behavior, you get a euphoric feeling from doing it as a result of a dopamine release, notes Poldrack. This leads to changes in both the connections between neurons and the brain systems responsible for actions—and can largely account for why we start to form bad habits in the first place.

Many of these rewarding stimuli—like sugar or substances—are powerful, too. And our physiological reaction to them in present day can be linked all the way back to evolution, says Poldrack. In the cavemen days, meat wasn’t salted, dry-rubbed or grilled to perfection. “Our brains aren’t well-equipped to deal with the big rush one gets from these sorts of things,” Poldrack says. As a result, the frontal lobe, the brain’s “control center,” gets overwhelmed, he says.

“You’re more likely to do the thing you don’t want to do when you’re stressed out,” Poldrack says.

There are however, ways to address the root cause of these seemingly detrimental habits.

Some solutions? Try to get more sleep, exercise regularly and opt for stress reduction techniques like meditation, which can all work to increase willpower and overall brain health, says Poldrack.

Know your cues

Habits, Berkman says, have three main parts: a cue, a routine and a reward.

Cues are the context where you tend to engage in the behavior. If you’re a smoker for example, the cue might be work breaks. If you’re a dessert aficionado, it might be simply scouring the dessert menu. “You’re most likely to relapse in the context of when you’ve done it before,” Berkman says.

Knowing your triggers can help you avoid them. Berkman suggests that smokers dispose of items like ashtrays that might remind them of their habit or people who are trying to cut back on drinking should avoid walking by the bar they always pop into for happy hour.

Capitalizing on major life changes can also help break an unhealthy habit. While you might think a cross-country move or a new job is no time to introduce even more changes into your life, Berkman notes that shifts in lifestyle can actually be the ideal opportunity for eliminating a vice. “You’re going into new contexts and situations, so you don’t have those same cues—it’s a chance to form new habits,” he says.

If you’re used to lighting up on your way to work for instance, moving to a new city gives you a chance to take public transportation or to dig into a new podcast instead of a pack of cigarettes, because you are in a new environment, says Berkman.

Replace a bad habit with a good one

Instead of trying to stop doing something—“It’s hard to stop a behavior,” says Berkman—start doing something else.

“We are action-oriented creatures,” says Berkman. Some studies have shown that the more you suppress your thoughts, the more likely you are to think about that thought or even revert back to that bad habit. A 2008 study in Appetite, found that those who suppressed their thoughts about eating chocolate exhibited a behavioral rebound effect, where they consumed significantly more chocolate than those who didn’t. Similarly, a 2010 study published in Psychological Science found that smokers who tried to restrain their thoughts about smoking wound up thinking about it even more.

If you’re a smoker and you tell yourself not to smoke, your brain still hears “smoke,” Berkman says. Conversely, if you tell yourself to chew gum every time you want a cigarette, your brain has a more positive, concrete action to do, he notes. Similarly, if 5 p.m. has been linked with a glass of wine for years, use it as a time to, instead, double down on hydration and make sure the fridge is stocked with seltzers, cold water and lemon, Berkman says.

But forming a new habit takes time and commitment, so don’t be discouraged if it takes longer than you might expect. A 2010 study published in The European Journal of Social Psychology found it took an average of 66 days for a behavior to change (though time varied from 18 to 254 days).

Have a better reason for quitting

Even if you replace a “bad” habit with a better one, sometimes the original vice will have a stronger biological “reward” than its substitute, Berkman says. For example, your brain knows that gum is not nicotine and therefore won’t produce the same euphoric feeling that smoking a cigarette would, he says. This is where the importance of having an intrinsic motivation comes into play.

Intellectually, we know that quitting smoking is good for our health and limiting how many burgers we eat might help us lose weight. But rooting habit changes in specific and personal reasons—giving up smoking for good may mean spending more years with your family or eating healthier may give you more energy for those outdoor adventures you used to enjoy—provides a stronger dose of motivation, says Berkman.

Set better goals

Rather than focusing on a more general goal—like I will not grab a cookie on the way out of the cafeteria—Poldrack suggests imagining more specifically how you’ll implement this goal into your daily life.

Examining how you’ve responded to the situation in the past and determining what you can do to avoid the cookies in the future, might be all it takes to break the habit, says Poldrack. This may mean simply not walking by the rack of sweets itself.

“It’s always going to be easier to react based on something you’ve already planned out in the past versus trying to come up with a new plan on the fly,” Poldrack says.

Plus, thinking about how exactly you’re going to do something helps you develop the mindset that you can do something, he notes. And that’s half the battle.

Get our Health Newsletter. Sign up to receive the latest health and science news, plus answers to wellness questions and expert tips. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.