Insertion sort implementation.