The two main types of dialysis, hemodialysis and peritoneal dialysis, remove wastes and excess water from the blood in different ways. Hemodialysis removes wastes and water by circulating blood outside the body through an external filter, called a dialyzer, that contains a semipermeable membrane. The blood flows in one direction and the dialysate flows in the opposite. The counter-current flow of the blood and dialysate maximizes the concentration gradient of solutes between the blood and dialysate, which helps to remove more urea and creatinine from the blood. The concentrations of solutes normally found in the urine (for example potassium, phosphorus and urea) are undesirably high in the blood, but low or absent in the dialysis solution, and constant replacement of the dialysate ensures that the concentration of undesired solutes is kept low on this side of the membrane. The dialysis solution has levels of minerals like potassium and calcium that are similar to their natural concentration in healthy blood. For another solute, bicarbonate, dialysis solution level is set at a slightly higher level than in normal blood, to encourage the diffusion of bicarbonate into the blood, to act as a pH buffer to neutralize the metabolic acidosis that is often present in these patients. The levels of the components of dialysate are typically prescribed by a nephrologist according to the needs of the individual patient.