Remove duplicated code in Renderer