Now assigns all types of materials correctly..