Enhancement of hardness and chloride removal and reduction of Cl2 release and corrosion in electrodeionization units