Move function to Model.