Cities have been tinkering with their sewer systems for more than 2,000 years, trying to improve the way we get rid of bad water and pipe in good water.

We're going to skip over all that fascinating history, though, and instead focus on the modern system in use around much of the developed world today.

It starts with the pipes connected to our sinks and toilets.

"So all our pipes go into a sewer system, and all of that wastewater that we are putting down our drains and flushing down our toilet, ends up at different wastewater treatment plants," explains Christopher Sales, an assistant professor in the Department of Civil, Architectural, and Environmental Engineering, at Drexel University.

He, along with his graduate assistant Jake Price, spend their days thinking about wastewater, and what to do with it after it arrives at the treatment plant.

"Wastewater enters the wastewater treatment plant, and it goes through a couple of bar screens to remove large, solid objects, and then it goes into a large settling tank, in which the fats and the lipids and all the less dense material will float to the top, and it is skimmed off," says Price.

So the chunks have been screened out and the top skimmed. Now, it's time to tackle the murky, dissolved stuff.

"Yeah, the second step, we often call it in the wastewater treatment world - the activated sludge process," says Sales.

Activated sludge is a poorly branded but very valuable, brownish substance. It is teeming with good bacteria that's been recycled from previously aerated wastewater. When the sludge is added to the new wastewater, it thrives off of the oxygen being bubbled into the tanks and eats up the diluted organic waste. It then clumps together and settles to the bottom, where it can be filtered out and used again.

After the miraculously natural activated sludge process is complete, the wastewater is pretty clean. Still not quite potable, but in many parts of the county, they call it good. Maybe add a little chlorine, then discharge it into rivers or lakes.

Overall, the modern treatment process gets the job done.

"It works okay, but we are finding that these wastewater treatment plants don't remove enough nitrogen," says Sales.

He's talking about the nitrogen from us, from our waste, which is still in high concentrations in the discharge (often called the effluent).

If you've ever read the back of a bag of fertilizer, you know nitrogen is a good thing in the right doses. Plants love it. But in the rivers and lakes that receive wastewater, algae like it too much. They go crazy on the stuff, like they're at an all-you-can-eat buffet. The result is a massive algal bloom.

But eventually, the nitrogen runs out, and the algae dies off.

"The cells die, and when the cells die, they're grazed upon by other microorganisms. And those microorganisms tend to consume a very large amount of oxygen," says Price.

They consume up all the oxygen in the water, creating, essentially, dead zones where fish can't survive. And that's bad news for the entire ecosystem.

"Very bad," says Sales.

Pond scum to the rescue

Right now, some facilities do take extra steps to pull out nitrogen from the effluent, but it's a time-consuming process that requires extra ingredients, plus a good deal of energy and space, which means it costs a good deal of money.

Sales and Price, along with collaborators at the University of Pennsylvania, are working on an alternative solution, and curiously, it uses that same algae, which in the natural environment causes so much trouble.

Inside a windowless laboratory, Sales shows off a graduated cylinder, the bottom half thick with pea soup-like algae.

"There is kind of a greenish zone on the bottom of it, where there is algae, actually a mixture of algae and bacteria," he explains.

The cylinder is connected to a series of tubes and pumps, which slowly circulate a few liters of aerated wastewater.

"Each droplet of water that goes into our reactor spends at least eight hours in the reactor system," he says.

During that cycle, the clump of algae and bacteria sucks up the nitrogen, thriving off of it. The water is basically getting filtered by this living community of microorganisms, eventually leaving the wastewater safer for discharge.

"The water that comes out of here doesn't have a zero concentration of those nitrogen species, but it is significantly lower than what was in the wastewater," says Sales.

Their research, which was recently published in the Journal of Visualized Experiments, shows that under the right conditions, the algae pulls out up to 80 percent of the nitrogen. The other good result is that the this thick cluster of algae is itself valuable. In theory, it can be processed and turned into biofuels or fertilizer.

Still, this solution only works at lab-scale. Best case, Sales and Price say it could take a decade before they've engineered a system big enough to actually function at a wastewater treatment facility.

Scientists have been experimenting with algae's ability to cleanse water for a half-century. This team of scientists, though, are using modern genome scanning tools to figure out which players inside the algae-bacteria world are most active in the process.

"We're not just imagining these as black boxes," says Sales. "We are starting to look at the microbial processes, the enzymatic reactions, who's there, who are the players, in this whole kind of mixture, this green sludge that's in these reactors."

They're trying to build a better algae by simply harnessing what's already in the world.

"The idea of relying on microbes and on mother nature's millions and billions of years of evolution to clean up human's messes," says Price, "is a very elegant solution."