Refactor model