Updated by removing code duplication Updated with review comments Change-Id: I57a596ed09d4d543964059e18a86e143108305ec