Living with a pet is an exercise in compromise. In exchange for years of companionship, entertainment and endless love, you tolerate the stains and various odors they leave behind in your home.

From accidents to litter boxes, pets come with a potpourri of unpleasant aromas. But with some vigilance and planning, you can keep your home smelling fresh.

Removing accidents and stains

The sooner you catch a mess, the better the odds you’ll be able to restore the material to its original state and avoid unpleasant smells. But even if you’re a bit late to the scene (animals typically reserve their bathroom issues for when owners aren’t home) don’t assume you have to toss your favorite rug or couch cushion. It’s still possible to remove the stain — and certainly the odor — if you use the right products.

Best practices for odor and stain removal vary according to what kind of mess you’re dealing with, and what type of surface your animal chose to do their business on.

For urine, you’ll generally want to get a special urine remover, according to Kristin DiNicolantonio, a senior director of communications with the American Cleaning Institute. Look for something that has enzymes in it; these work to break down the molecules in pee and are especially effective at targeting that ammonia smell associated with cat urine.

If the pee is on a material like a carpet, rug, couch or mattress, blot away the excess liquid before going in with your urine-enzyme spray. After spraying, wait three minutes, then wipe the area with a damp cloth. You’ll want to wait until it’s completely dry to let your animals back on it. (And if you’re concerned about a cleaner damaging the color of the fabric, DiNicolantonio suggests testing it on a small, less-visible area first.)

For poop on those same surfaces, DiNicolantonio recommends an at-home mixture: add a half tablespoon of dishwashing liquid to one tablespoon of white vinegar and two cups of warm water. Obviously, the first step is to remove and dispose of the poop. Then blot the stain slowly with the vinegar mixture and a cloth. When all of the excess liquid is gone, repeat and blot until you no longer see the poop. Wipe the area with a cloth dampened with cold water, then blot with a fresh sponge. If the mess is on a cushion or mattress with a removable cover, it’s best to throw that in the washer with an enzyme-based detergent, too.

For pee or poop on less-porous floors and surfaces like tile, granite and marble, any antibacterial disinfectant should remove both the stain and odor. You could still go in with an enzyme spray first to ensure any microbes are completely broken down before attacking the area with rags and disinfectant.

And for best results, make sure you follow the directions on any cleaning product to the letter, says Stephen Cole, a vet and an assistant professor of veterinary microbiology at the University of Pennsylvania.

“Like, exactly how the manufacturer recommends it, or else it probably won’t work the same way,” he says. “If you want to disinfect a surface, all you need to do is make sure that it gets cleaned first, and then use the disinfectant. It has to stay wet for the amount of time that it says on the back of the container in order for it to be effective.”

Furnish strategically

An easy way to avoid soiled sofas and stinky beds is to prep your furniture with protective materials before you bring the pieces around your pet. It’s a good idea to get waterproof mattress pads and to slipcover any nice furniture or treat it with a fabric stain protector.

If you’re in the market for new furniture, think about the fabric and make of the piece before bringing it home. DiNicolantonio, who also has a background in interior design, says you can look for specific stain- and pet-resistant weaves in chairs, sofas and rugs; the tighter the weave and higher the thread count, the more durable it will be in the face of stains and even scratches.

While leather might seem like a sensible option — it won’t cling to fur and air hair like other materials — it’s not the most pet-friendly upholstery. “If your leather is untreated, it’s going to be easier to cause stains and odors and the leather can become dry and brittle,” DiNicolantonio says.

She recommends pet parents avoid leather altogether. (Your best bets will be something like microfiber, wool, or polyester — even if it loses a few points in the style department.) If the leather is already in your home, check with the manufacturer on the proper treatment and conditioning protocols before trying to clean it. Enzyme removers can work to kill the bacteria and odor of the pet mess, but they may also remove the dye on your leather, leaving a mark, or dry it out, leaving it dull. Test everything on a small, hidden part of the furniture before trying anything major.

Choose their space carefully

In terms of reducing more general pet odors, take a hard look at where you store their things. Bacteria love moisture, for example, so keeping a litter box in the bathroom can trap odors longer than necessary.

Ideally (if your cat will tolerate it), you would move the litter box to a dry corner of a low-traffic, low-visibility room, such as a small closet or office, to prevent the smells from permeating more lived-in spaces. If that’s not an option, minimize the moisture in the bathroom by opening a window, running a fan, or using a dehumidifier. Also scoop the litter at least once a day.

For other animals, keeping items they use regularly in a secure, closed-off space can reduce the spread of unpleasant odors that can come from treats, food or chew toys. DiNicolantonio, for example, keeps all of her dog’s stuff — food, toys, harnesses, and leashes — in one designated, dry cabinet. If you’re hurting for cabinet space, you can get creative with plastic bins and tuck-away storage.

Don’t skimp on the maintenance cleaning

It sounds like a no-brainer, but the best way to avoid a stinky home with animals is the same way to avoid a stinky home with humans — regular cleaning.

Many of us probably don’t wash our own bedsheets as often as we should, but DiNicolantonio says pet items — including their bed, any blankets they like, and even leashes and collars — should be washed at least once a week. Give their linens a vacuum first, then wash them on a high temperature with a mild bleach. (Check the tags first to make sure they are bleach-safe.)

Litter boxes, cages and crates also should be emptied and given a deep clean at least biweekly. Cat urine can react with the bacteria in litter to release that ammonia smell, so refreshing the litter frequently will reduce the odors lingering in your home. (According to Cole, it’s recommended that pregnant people sit out of litter box cleaning duty; cat feces can contain Toxoplasma gondii, a parasite that can be dangerous for pregnant and immunocompromised people.)

First empty the litter box or cage, then wash it with soap and warm water before filling the container with a water-bleach solution and letting it sit for a few minutes. Rinse thoroughly and dry the cage or litter box before allowing your pet back inside.

And if you have a particularly pungent friend who enjoys hanging out on your carpet and couch, vacuum the surface, sprinkle a little baking soda on the items and let it sit for five minutes, then vacuum again. This can help get out odors that may be trapped deep in the fabric.

DiNicolantonio said you can try fabric sprays to manage smells.

, but these and other products like plug-in diffusers and air fresheners won’t do much to treat the stink (or will result in something even funkier) if you’re not regularly addressing the sources of the odor.