abstracted more code from the model.