Refactored Shared.uids update code