new: swap code