class design changed to make it modular