Generalizes the processModules functions