remove the foreach usage