Writes nested loop for you!