Put diffing code in a loop