Refactored initialize function of the model object.