sortedInsert works