code improvement 2 added a main control file