Improved insertionSort