Refactored function replace_uid_Tag