changed compoundDocument to richDocument