Sync with internal version.

When we have more time we'll start using this version directly.