cleaned up docfact() and docprob()