refactoring user management