Additional IF statements, using array indexes to insert into correct location. Single sort to place in sorted and temp