Pull in changes from upstream

We need to review this.