added in undo/redo functionality at document level