Fix #3: sortedIndex function works properly