Merge loops into one.