The interaction history of a document can be modelled as a tree of command objects. This model does not only support recovery (undo/redo), but is also suitable for cooperation between distributed users working on a common document. Various coupling modes can be supported. Switching between modes is supported by regarding different versions of a document as different branches of the history. Branches can later be merged using a selective redo mechanism. Synchronous cooperation is supported by replicating the document state and exchanging command objects. Optimistic concurrency control can be applied because conflicting actions can later be undone automatically.