added proper versioning support in documents (re #372)