focusing on sort_index, this commit will be squashed later