The beleaguered citizens of Flint, Michigan, who experienced one of the worst lead poisoning crises in recent memory, are now getting at least $97 million in federal and state money to pay for new, lead-free pipes.

A federal judge in Detroit has approved $97 million for rebuilding Flint’s water infrastructure and supporting ongoing health interventions in a lawsuit that sought compensation for widespread lead contamination caused by city officials.

Money from the settlement will be used to address three main priorities in Flint:

Replace lead pipes in 18,000 Flint households by 2020. Continue to distribute bottled water to citizens unable to access clean drinking water. Fund health care programs for residents affected by lead poisoning.

Today’s settlement added another $57 million for ongoing relief and infrastructure improvements in Flint, bringing the total to $97 million.

The state of Michigan is responsible for covering $47 million of the settlement. An additional $10 million in federal funds was allocated to cover unexpected costs. The other $40 million budgeted is federal funding allocated last year through an Obama-era federal water infrastructure fund.

The terms of the settlement will speed up infrastructure improvements and require at minimum 6,000 households in the city to have new, lead-free pipelines by 2018. By 2020, 18,000 households are expected to have new pipelines. In addition, the city will continue monitoring efforts and testing individual households for elevated lead levels in the water.

The settlement comes in response to a lawsuit filed last year by a coalition of religious, environmental, and civil rights activists that alleged the water in Flint was unsafe to drink and that state and city officials were in direct violation of the federal Safe Drinking Water Act.

“For the first time, there will be an enforceable commitment to get the lead pipes out of the ground,” said Dimple Chaudhary, a senior attorney for the Natural Resources Defense Council (NRDC), in a statement.

To prevent another Flint, we need to invest in crumbling water infrastructure

Professional civil engineers estimate that overhauling America’s drinking water system and bringing it up to code will cost at least $1 trillion over the next 25 years.

More than 6 million lead-contaminated water pipelines nationwide must be replaced, and many distribution points are suffering from decay or need outdated parts replaced. Plus, there are many drinking water plants in the US in dire need of maintenance and improvement.

But congressional funding currently hovers at a little over $2 billion annually for clean water infrastructure, which will not be enough to foot the bill. Even if funding levels were restored to $8 billion, as stipulated under the 2009 American Recovery and Reinvestment Act, it still wouldn’t be enough.

Some activists are hopeful that President Donald Trump could become a clean drinking water champion, given his trillion-dollar infrastructure plan.

Adam Krantz, the CEO of the National Association of Clean Water Agencies, is cautiously optimistic that Trump will make good on his promises.

“We’re in this situation where the federal government has reduced funding for both wastewater and drinking water infrastructure, and it’s the municipal waste payer who pays for the upkeep,” said Krantz. “Municipalities can’t keep up ... The federal government will have to step up its involvement.”