Replace uids with a simple index