Expanded to distinguish between result, query, and data case canonicalization.
Remove commented code.