Once you have fruit flies, you have to work to do some work to evict them for good. How did the annoying little critters get in the kitchen in the first place?

Well, true to their name, they feed on delicious fruit ripening on your counter. As long as you keep your apples out on the counter, they’ll find a way to get to them—no matter how diligent you are about closing the screen door.

But fear not, fruit-lover! We found multiple tried-and-true methods for getting rid of fruit flies. Here’s your plan of action.

1. Figure out where the fruit flies are coming from

“In order to manage fruit flies, you have to truly find the source,” says Salila Travers of Aztec Organic Pest Control in Austin, TX. A female fruit fly can lay up to 500 eggs in her 40-day life, which explains how small fruit fly infestations become big fruit fly infestations so quickly.

To eradicate your unwanted visitors, you need to first eliminate their egg-laying sites. Put any fruit or vegetables in the fridge. Clean out trash cans and recycling cans. Wipe down counters, sinks, and anything that could have rotting food stuck to it: damp sponges and mops, damp potting soil from indoor plants, and your sink’s drain are common culprits. Travers advises putting your plants in a confined space overnight to see if any flies are hatching from the pots. If so, re-pot them ASAP.

If you suspect your sink may be the issue, put packing tape over half the drain overnight. If you wake up with flies stuck to the tape, “You know they’re breeding in the organic matter that lines the drain,” she says. (Yuck.) She recommends using an enzyme gel to remove any drain gunk. Pouring bleach, boiling water, or cleaning liquids down the sink can kill the existing eggs, but won’t remove the stuck food that they’re breeding in.

2. Set a fruit fly trap

Once you’ve removed the source of the flies, it’s time to eliminate the existing flies. Here are two time-tested DIY fruit fly trap options (you can also buy a pre-made version for about $3).

  • Funnel trap: Take a jar or bottle (a mason jar works well) and fill the bottom with diluted apple cider vinegar. Put in a drop of dish soap; this breaks the surface tension of the vinegar and ensures the flies drown. Make a paper funnel and set it, point down, in the jar, covering the jar opening. The flies go down the funnel to get to the delicious vinegar, but can’t get back out. Put traps wherever the flies seem to be gathering, and change the vinegar every 12 hours or so.
  • Plastic wrap trap: Grab a bowl, jar, food storage container, or anything with a decent surface area. Fill it with something that flies like: vinegar or red wine work well. Melissa Maker of Clean My Space recommends balsamic vinegar. Put a piece of plastic wrap over the top. Poke tiny holes in the plastic with a paring knife or toothpick and set the trap near the flies. They will follow the smell and fly in the holes—but won’t be able to find their way out. When the bowl fills with flies, clean it with soap and water and start again.

3. Try fruit fly spray

If you prefer to take a more aggressive approach, spray the intruders with undiluted rubbing alcohol, glass cleaner, general purpose cleaner, or even just water. It will knock them out of the air for long enough for you to wipe them up and throw them away (outside, obviously). To deter future flies, spray your kitchen with lemongrass, mint, or eucalyptus essential oil blended with water. These odors repel fruit flies but are harmless to people and pets.

4. Prevent fruit flies from entering your home

Once your space is finally clear of the flies, it’s time to make sure they stay gone for good. Essential oil spray will keep your kitchen smelling nice and repel flies naturally. Keep screens on windows and doors. And wash your fruit once you bring it home from the market and before you eat it.

According to San Francisco’s City Lab, fruit fly eggs are often on the fruit when you buy it, which is why they seem to hatch out of nowhere. Make a habit of washing raw fruits and veggies you’re going to leave out on the counter, even those whose skin you don’t eat, like bananas and oranges. And during the high season for fruit flies, you might just have to put all fruit in the fridge.