added support for embedded documents