A machine-readable medium with instructions for pumping blood from a patient's blood stream into an access line, introducing an anticoagulant solution into the pumped blood, filtering the pumped blood and delivering it to a return line, introducing a substitution fluid into the pumped blood, introducing a calcium and magnesium solution into the blood traveling through the return line, and returning the blood back to the patient's blood stream.