Merged some code of renderer.