Encapsulate render loop

With ability to use thread pool to speed up rendering