Refactored the code

Signed-off-by: Kalyan <kalyan.menda@whiteskylabs.com>