The shaping of the welfare state