Reorganize material inspection code for #62