remove unneeded swaps.