Cleaning code of swap.cpp