Implemention of swapOut and swapIn (in progress)