Bring up to speed with mainline
Additional changes to make it build again.