having problem impelmenting undoLogic