created the model logic