refactor of models class