Nitrogen study could help farmers and protect water, ecosyst