Hard water is a common quality of water which contains dissolved compounds of calcium and magnesium and, sometimes, other divalent and trivalent metallic elements. The term hardness was originally applied to waters that were hard to wash in, referring to the soap wasting properties of hard water. Hardness prevents soap from lathering by causing the development of an insoluble curdy precipitate in the water; hardness typically causes the buildup of hardness scale (such as seen in cooking pans). Dissolved calcium and magnesium salts are primarily responsible for most scaling in pipes and water heaters and cause numerous problems in laundry, kitchen, and bath. Hardness is usually expressed in grains per gallon (or ppm) as calcium carbonate equivalent.