Added sorting to the index table