refactor according to DocumentIndexed clss.