modify code for Model and View