Children living on farms have a lower risk of asthma than children who don’t because they are surrounded by a greater variety of germs, according to two large-scale studies published Wednesday.

The prevalence of asthma in the U.S. has doubled over the past 30 years, and one theory for the increase blames urban and suburban living environments that are too clean. The latest findings, published in the New England Journal of Medicine, bolster what is often known as the hygiene theory, which says that contact with bacteria and other microbes is necessary to building a normal immune system.

The key appears to be exposure to a diversity of bugs, not just more of them, according to Markus Ege, an epidemiologist at the Children’s Hospital of Munich and first author on the paper that covered both studies.

“Bacteria can be beneficial for asthma,” said Dr. Ege. “You have to have microbes that educate the immune system. But you have to have the right ones.”

Previous research, including some conducted by Dr. Ege’s group, has found that children raised on farms exhibit substantially reduced risk for asthma and allergies