Incorporating comments made to the upstream patch

Change-Id: Ifd2d883bf92b8d6229c61c929ad75d2b7c3ab41e