Made GUI into a thread