refactored with uid