Refactor out disk swapping functions.