almost all functionalities done