Several years ago, Havre, Montana had a problem. Its treated wastewater had too many nutrients. Fixing it was expected to cost millions of dollars. But, wastewater workers discovered a cheap, upcycled solution through the magic of chemistry and beer.

Drue Newfield, the superintendent at Havre’s Wastewater Treatment Facility, looks out across a series of large outdoor tanks full of something that looks like frothy chocolate milk. Every day, this place turns 1.5 million gallons of waste from sinks, showers and toilets into clean water to be released into the Milk River just beyond the line of trees.

Until recently, the facility had issues with phosphorus and nitrogen. The nutrients can cause algae blooms in rivers, which suck up all the oxygen and kill aquatic life.

Newfield says Havre spent over $10 million on upgrades in 2015 in an effort to meet the Environmental Protection Agency’s newer, tougher standards.

“Which wasn’t enough. That upgraded a lot of the old plant as well that just needed to be fixed,” Newfield says.

He says they were going to have to spend tens-of-thousands of dollars each year on a chemical additive and potentially a million dollars on another upgrade.

“That’s where the barley came in and was able to do what we didn’t get,” Newfield says.

Across town at Triple Dog Brewing, owner Michael Garrity walks past his large, shiny fermenters in the back and opens the garage door.

Rachel Cramer / Yellowstone Public Radio

Sitting right outside are seven large buckets full of moist grain leftover from brewing beer.

"It just smells like oatmeal. That’s pretty much what it is. Put a little sugar on it, you’ve got yourself some breakfast," Garrity says.

Garrity used to take the spent barley to Havre’s compost site. It took a lot of time and was kind of messy.

Three years ago, Newfield asked Garrity if he could take the barley to the wastewater treatment facility.

“Just out of a thought that I had, I took the fermented organics from the brewery and added it, and we saw those bacteria bring our phosphorus levels lower," Newfield says.

Bacteria play a big role removing nitrogen and phosphorus at wastewater treatment facilities. But to be really effective, bacteria need some extra food at the end of the treatment process when they’re starving for carbon and volatile fatty acids. Luckily, spent barley has both.

“So we began to do it over time. We started learning how much to add," Newfield says.

Every morning, one of the operators dumps 16 gallons of spent barley into the water as it heads towards the treatment pools to give the hard-working bacteria a boost. Newfield says they were able to reduce the nitrogen and phosphorus levels and save the town a lot of money: $16,000 annually for a specific chemical treatment and possibly a million dollar on another upgrade.

The Environmental Protection Agency gave Havre an honorable mention at the end of last year for its innovative solution.

Paul Driscoll with the Montana Department of Environmental Quality says, to the best of his knowledge, Havre is the only place in Montana using spent barley to treat wastewater. But with the recent award from the EPA, Newfield says he’s been getting more calls from communities both in and out of state interested in the possibility of using brewery waste.

About 300 miles to the south, Bozeman tried something similar last summer with a pilot project at its Water Reclamation Facility.

Coralynn Revis, an engineering consultant and project manager with HDR, looks down at the water as it moves between the different tanks. In some, the water is calm. In others, it bubbles like a jacuzzi. The facility treats over four times as much wastewater as Havre.

Rachel Cramer / Yellowstone Public Radio

Rather than using spent barley, Revis wanted to find out if the liquid waste from making beer could reduce the facility’s nitrogen and phosphorus levels.

“We have all of these craft breweries. They make all of this high strength waste, which is rich in carbon, which causes trouble and it’s what we’re treating for coming into the plant,” Revis says.

Bozeman has more breweries than Havre. When they all dump their liquid waste down the drain, the Water Reclamation Facility has to absorb it all and treat it.

Revis says her team figured out that controlling the flow and feeding it to the bacteria at the end of the treatment process turned a problem into a solution.

During the pilot project, she worked with MAP Brewing to siphon the liquid waste into a separate tank. The city hauled it to the facility.

“We had a tank of brewery waste that we put over there on the ground, and then we ran some little peristaltic pumps up, and then there’s a mixer under here,” Revis says.

Revis says this method dropped the nitrogen and phosphorus levels, but Bozeman’s Water Reclamation Facility stopped using it once the pilot project ended.

“So the reason it was just a pilot is because it would take some effort to bring it full scale. Being able to go truck and pick up all the brewery waste when you need it and coordinate all that, it would take a full-scale program to be able to do that all the time," Revis says.

Since the facility’s nitrogen and phosphorus levels are allowed with its current permit from Montana DEQ, Revis says it would be hard for Bozeman to justify spending public money on developing a new program. The pilot project alone, which was funded by her company HDR, was $10,000. It lasted less than two months.

“There are stricter regulations coming. So in the future, that might be a good choice for them,” Revis says.