Soap can be prepared in the laboratory by saponification, which is the process of boiling palm oil with a sodium hydroxide solution. This causes the palm oil to hydrolyze, producing glycerol and sodium salts of fatty acids known as soap. Sodium chloride is added to reduce the soap's solubility in water and precipitate it out of solution. Soap molecules have both hydrophilic sodium ion heads and hydrophobic fatty acid tails, allowing them to emulsify grease and suspend it in water for removal. Detergents are more effective than soap in hard water since soap reacts with calcium and magnesium ions to form insoluble scum, while detergents do not form scum.