Start to simplify material.cpp