Undo is now working correctly