What factors contributed to the implementation of the welfare system in the United States during the 20th century?