added random key generation