Changed ToLower/ToUpper to culture-insensitive ToLowerInvariant/ToUpperInvariant