another revamp of the UID detection code