refactoring model layer again