added multithreading for rendering on window resize