multi iteration version