Add stuff from 0ed1f1b5a22a that got lost in the world-ending merge.

Change-Id: I0d787f67b41113f3b7454b9b1dfc1644dabfcdb1