refactor $CFG