move rendering to render method