refactored user model algorithm