refactoring model as parameter