implement render function