Initial merge of upstream code

Change-Id: I638f39b781f5078f95b7fe11f6d26b6d1641552a