imolemented the main functions of the model.