make the program run iteratively not tested yet