Updated from private repo

This isn't the right way to do this, but the changes were just too substantial
to cherry-pick without breaking.