Modified Insertion sort