some config.c refactoring