Add undo functionality