Refactor Renderer. Move every common code to renderer class.