some performance improvments to the renderer