Used worker to multi-thread the rendering. Now the UI does not need to hang while the image in generated and it is being generated faster.