loop in loop work index