Code refactoring

Signed-off-by: Davinderpal Singh Rehal <davinderpalrehal@gmail.com>