Added code to generate cfg file,