working out a nested loop