added I think the last needed function to the model