Added subdocument handling