Insertion sort implementation