recreated all the functionalities with  proper modularity