code cleanup and refactoring for task2

Change-Id: I27f4088d01eed255cbba3f76bd272e3c44944e23
Signed-off-by: NiharKhetan <nihar.khetan@gmail.com>