updated loop