ENH: add undo functionality