Refactoring all the code to a more modular & object oriented design

Signed-off-by: Karteek Mekala <Karteek.Kumar.M@gmail.com>