refactoring of user model