refactor Model layer