refactor model