Insertion sorting algorithm