refactor of models