updated loop to bridge out loop structure

needs testing