add functionality of undo.