Revert the partial revert, and revert the unreverted part

Change-Id: Ib83f77d7653fe0ad76a5484d29cbb550ce7f6a3e