Add region swapOut, beforeSwapOut

fixes #1718