Refactor undo tools.