The Flint water crisis is still far from over, but a court agreement on Monday has given residents of the city perhaps their biggest victory yet.

As terms of the settlement, which was filed in the U.S. District Court to close a civil lawsuit, the state of Michigan will spend $87 million to replace pipes and provide free bottled water to Flint residents. About 18,000 lead and galvanized water lines in Flint will be replaced by 2020.

According to MLive, that $87 million figure includes at leat $47 million that must come from sources other than the ones approved by Congress and President Barack Obama in 2016. The state must also reserve an extra $10 million just in case the service line replacements cost more than expected, and commit to monitor a sampling of homes before and after those replacements are done. The monitors will be done by a third party, and test 100 homes for at least three years.

Actor and activist Jesse Williams speaks at the #Justice4Flint benefit concert on March 22, 2016.

A hearing to approve the settlement, which would legally bind the city and state to take action, is scheduled for today.

Flint residents have had poisonous water for three years. The crisis is a result of an emergency manager – an official whose power usurps local elected officials – appointed by Michigan Governor Rick Snyder. To cut costs in Flint, the emergency manager switched the city’s water source from Detroit’s water system to the Flint River, and failed to treat the water properly. The water was corrosive, which made it leach lead from city pipelines in the city. Children have been exposed to high lead levels, and 12 people have died of Legionairres Disease, as a result. The water has been unusable ever since, so residents have had to use filters and pick up bottled water at stations around the city. Two ex-emergency managers and former city employees have been charged with felonies.

Celebrities have been involved in various fundraising and awareness-raising efforts to fight the crisis. In 2016, REVOLT livestreamed #Justice4Flint, a benefit show organized by the collective Blackout for Human Rights. The concert featured performers like Stevie Wonder, Janelle Monae, and Hannibal Burress, and raised $18,000 for the cause.