finished swapElements