The thought of composting used to overwhelm me. All those fancy containers and tending and stirring — not to mention that in my San Francisco neighborhood, rats hang from the plum trees and make a beeline for the bird food any time I leave out a handful of seed.

I knew all the arguments for composting. It keeps organic waste out of landfills, where it makes up a quarter of everything we throw away and releases  harmful greenhouse gases like methane. And using rich compost in the garden not only reduces the need for chemical fertilizers, it saves money and adds valuable nutrients to your soil.

Still, fear of rats (and other urban varmints) getting into my compost kept me away from it.

Related: 10 Surprising Ways to Help the Planet

It turns out that keeping furry critters out of the compost pile isn’t so hard. All you have to do is follow the time-tested rules of composting and you’ll have natural fertilizer to die for without the unwanted guests.

Choose a good location. Create your compost pile or bin in a dry, shady spot with a convenient water source nearby (make sure the hose will stretch that far). The ideal spot is safely away from your house but not so far that it’s inconvenient to carry scraps to it. You may want it close to your garden.

Leave out the meat. Sorry, but you can’t recycle your chicken bones and oven grease in the compost pit. Keep out any bones, dairy, grease and meat scraps. Such scraps can make the pile too hot, and they’ll cause a stench that may repel you and the neighbors while serving as a calling card for the neighborhood skunks, raccoons and possums (and if you’re in bear country, guess who). For a more extensive list what you can (and can’t) compost, check the EPA's compost guide.

Bury your compost pile…. To keep skunks and other creatures away, experts suggest burying it at least 8 inches under the ground and covering it with a wire mesh and putting several heavy objects on top. As the pile heats up and starts breaking down the materials over the next few months, it will produce a dark, crumbly soil full of good bacteria, fungi, earthworms and plant nutrients to nourish your vegetable garden or flowers.

Related: Urban Gardeners: Are You Growing Produce in Contaminated Soil?

…Or invest in a compost tumbler or bin. The great thing about tumblers is that they mix and aerate the ingredients every time you turn them, and they keep out raccoons and other varmints. Compost bins, which should be at least 2 by 2 feet, use sealed lids or wire tops that will also deter hungry animals; the stirring just requires a little more effort.

People who live in bear country should compost only in bins, according to High Country Conservation Center, a nonprofit group based in Colorado. The center also recommends that you avoid “un-bearable” ingredients like cooked food or melon rinds and berries in times of high bear activity. If possums or dogs are sniffing around your bin, it’s too smelly. “With bears as your neighbor, compost correctly or compost indoors with worms,” the conservation center adds.

Stir it up. Experts recommend stirring or turning your outdoor compost to aerate it several times a week. Carrie Bennett of the Ecology Center in Berkeley, California, advises stirring it more frequently. Rats don’t like a food source as much when it is disturbed, she says, and stirring or turning also helps break down larger, more inviting pieces of decaying food. After you aerate your compost, cover it with more brown materials (such as wood chips or newspaper). This should keep it from becoming too pungent.

Mix the browns and greens. Mixing food waste with wood chips and other materials make it less smelly (and so less attractive to pests). Brown materials provide carbon and include things like woody clippings and paper, pine needles, dry leaves, pruned shrubbery, soiled paper, newspaper and wood chips. Greens produce nitrogen and include fruit and vegetable waste, grass clippings and coffee grounds. Some experts think you should mix in twice as many browns as greens, but others say a 50/50 ratio is just fine. To help keep away rats and other interested parties, Bennett suggests burying the “greens” under the browns (4 inches of browns on top should do it).

Related: 30 Environmentally Friendly Cleaning Products

Don’t forget to moisturize. Be sure to moisten dead leaves, wood chips and other dry material as you add it to the pile. The material should be as moist as a wrung-out sponge — that is, damp rather than mushy and wet.

By taking these simple steps, you’ll have compost that disappoints the bears, possums, foxes, raccoons, skunks and yes, even rats, and creates some rich soil for you in a matter of months.

Kathryn Olney is a freelance writer and editor who has served as a reporter and editor for California, San Francisco and Mother Jones magazines.