Refactoring user management