The angels that arrive at Sodom seem to fill a dual purpose: they save Lot and destroy the city. However, they are given a preliminary task of examining the city, to see whether righteous people can be found within. The townspeople teach the angels about the culture of the city while they were hosted in Lot's house. Why was Lot saved, when God had told Avraham that if ten righteous people were not found in the city the entire city would be destroyed?