Transforming the GUI into a runnalbe thread