adding code to generate main file