Some reapeting code extracted in Renderer.cs