refactor and adding spec of model.