Updated unique key generation.