Refactoring of refractive material's code