Changed if-statement to get String to generate key.