refactoring the models