optimized version of rendering