refactoring for the user model.