optimizing the rendering