Better performance for changing material

Much faster way to change material, using decrement version of for loop.