restructured. added support for document-based data