Added support for legacy documents.