correcting number_of_swaps, insertion method