Implement new features for DynamicDocument, add tests.