Working with on-demand rendering loop

This seems to be a complete solution.