Enhanced to save/restore the current page.