moved logic to the model