clean up of the code in main file.