There seems to be an extra layer in these loops that's not necessary.