some refactoring with the key and the config