implemented the undo command