Some refactoring + code comments

Change-Id: I6a5f4f316a02fe62bcf10e5959faaaf9edf152e5
Signed-off-by: Arpit Goyal <arpit.goyal@outlook.com>