Make processDocs function