Re-worked so this doesn't happen every foreach.