The aftermath of a breakup can be devastating. Most people emerge from it intact, but research has shown that the end of a romantic relationship can lead to insomnia, intrusive thoughts and even reduced immune function. While in the throes of a breakup, even the most motivated people can have a difficult time determining how best to get on with their lives.

Now, in a small new study published in the Journal of Experimental Psychology: General, researchers tested a variety of cognitive strategies and found one that worked the best for helping people get over a breakup.

The researchers gathered a group of 24 heartbroken people, ages 20-37, who had been in a long-term relationship for an average of 2.5 years. Some had been dumped, while others had ended their relationship, but all were upset about it—and most still loved their exes. In a series of prompts, they were coached using three cognitive strategies intended to help them move on.

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.

The first strategy was to negatively reappraise their ex. The person was asked to mull over the unfavorable aspects of their lover, like a particularly annoying habit. By highlighting the ex’s negative traits, the idea goes, the blow will be softened.

In another prompt, called love reappraisal, people were told to read and believe statements of acceptance, like “It’s ok to love someone I’m not longer with.” Instead of fighting how they feel, they were told to accept their feelings of love as perfectly normal without judgment.

The third strategy was distraction: to think about positive things unrelated to the ex, like a favorite food. Just as distracting oneself can help reduce cravings, it may also help a person overcome the persistent thoughts that come with a breakup.

A fourth prompt—the control condition—didn’t ask them to think about anything in particular.

Next, the researchers showed everyone a photo of their ex—a realistic touch, since these often pop up in real life on social media. They measured the intensity of emotion in response to the photo using electrodes placed on the posterior of the scalp. The EEG reading of the late positive potential (LPP) is a measure of not only emotion but motivated attention, or to what degree the person is captivated by the photo. In addition, the researchers measured how positive or negative the people felt and how much love they felt for the ex using a scale and questionnaire.

According to the EEG readings, all three strategies significantly decreased people’s emotional response to the photos relative to their responses in the control trials, which didn’t use prompts. However, only people who looked at their lover in a negative light also had a decrease in feelings of love toward their ex. But these people also reported being in a worse mood than when they started—suggesting that these negative thoughts, although helpful for moving on, may be distressing in the short term.

Distraction, on the other hand, made people feel better overall, but had no effect on how much they still loved their ex-partner. “Distraction is a form of avoidance, which has been shown to reduce the recovery from a breakup,” says study co-author Sandra Langeslag, director of the Neurocognition of Emotion and Motivation Lab at the University of Missouri–St. Louis, so the strategy should be used sparingly to boost mood in the short term.

Love reappraisal showed no effect on either love or mood, but still dulled the emotional response to the photo.

The authors classify love for another person as a learned motivation, similar to thirst or hunger, that pushes a person toward their partner in thought and in behavior. That can in turn elicit different emotions based on the situation. When love is reciprocated, one can feel joy, or, in the case of a breakup, persistent love feelings are associated with sadness and difficulty recovering an independent sense of self.

Classifying love as a motivation is controversial in the field; other experts believe that love is an emotion, like anger, or a script, like riding a bike. However, the endurance of love feelings (which last much longer than a typical bout of anger or joy), the complexity of these feelings (both positive and negative) and the intensity of infatuation all signal a motivation, the authors write.

To get over a breakup, heartbroken people change their way of thinking, which takes time. Just as it can be challenging to fight other motivations like food or drug cravings, “love regulation doesn’t work like an on/off switch,” Langeslag says. “To make a lasting change, you’ll probably have to regulate your love feelings regularly,” because the effects likely wear off after a short time. Writing a list of as many negative things about your ex as you can think of once a day until you feel better may be effective, she says. Though this exercise tends to make people feel worse, Langeslag says that this effect goes away. Her past research found that negative reappraisal also decreased infatuation and attachment to the ex, so it will make you feel better in the long run, she says.

The findings are particularly relevant in the age of social media, when photos of exes, and the resulting pangs of love, may come up frequently. “All three strategies may make it easier for people to deal with encounters and reminders of the ex-partner in real-life and on social media,” Langeslag says.

Contact us at letters@time.com.