moved code upstream

Change-Id: I9a9ba5dc50ed50fa7ea7aebed753a45b42eb53ec