refactoring the primer model and controller