small changes to document indexing.  still needs refinement