added changes from Aashish (separate python classes for making the code more modular)