use thread for the heavy work in the GUI