implement iterations to save all queries