improved swaps and insertions