Code refactoring in Form_Materials and Model_Materials