rewrite document list

in order to avoid duplicate code, and to uniformize documents list