refactor model passing