for instead of foreach to eliminate local var not used