added new examples and support for subdocuments