A Michigan judge is holding a hearing on a plan that would replace water lines at 18,000 homes in Flint, Michigan, where lead poisoned the water system.

The deal would settle a lawsuit in Detroit federal court. The agreement sets a 2020 deadline to replace lead or galvanized-steel lines serving Flint homes. Michigan and the federal government would pay for the job, which could cost nearly $100 million.

On Tuesday, federal Judge David Lawson will listen to lawyers representing Flint, the state and residents who sued.

Flint’s water was tainted with lead for at least 18 months, as the city tapped the Flint River but didn’t treat the water to reduce corrosion. As a result, lead leached from old pipes and fixtures.

In February, city officials announced the state would stop paying for Flint’s drinking water and end water credits for customers beginning March 1.

In addition to the credits ending, the state no longer provides funding for Flint’s connection to the Great Lakes Water Authority (GLWA), which adds up to about $1.2 million a month.

The changes followed state officials’ declarations that the water quality has improved, but city residents are still being advised not to drink the water unless it has been properly filtered.

“A senior advisor to Governor Rick Snyder has sent Flint’s Interim Chief Financial Officer, David Sabuda, a letter to inform him the credits currently being applied to the water portion of Flint utility customers’ accounts will no longer be provided after February 28, 2017,” Flint spokeswoman Kristin Moore wrote in a press release on Feb. 9. “State officials note the latest 6-month cycle of water testing that had results below the federal action level for the Lead and Copper Rule (LCR).”

The state pointed to findings from November of last year that showed sentinel site water testing of Flint’s water had a 90th percentile value of 8 ppb of lead. It citied the outcome as its reason for discontinuing the funding.

March bills were the last to include the state water relief credits of 20 percent for commercial accounts and 55 percent for residential accounts.