Implement swap.