removed .ToCharArray in foreach loops