change "getKey" to "generateKey" so it's called in one place