Updated to use the new RenderState code.