redefine model and refactoring