Added functions to handle swap-space