finished cfg and toc code
after merge