refactor the models