Further updates to material pipeline. Refactors for module code