modified for excluding documents