slight refactoring of config handling