Investigation, added the loop in the wrong place, this corrects it