clean-up part2: config logic improved