A study of the mechanism of water softening with lime