Added support for auto indexing on sorting.