Code Refactoring

Restructing code inorder to make it more modular.

Signed-off-by: Siddharth Goel <siddharth98391@gmail.com>