added generate html in a separate thread from the UI