move code from script.js to new file material_provider.js