refactor cfg