material: refine code, no function;