moved undoStack to be an Abstract Data Type