Improved loading of images which are being generated, instead of polling we send an event when the job is done through the socket.io connection. Thought this code needs a big cleanup.