These three ```for``` loops should be condensed into one.