Changed the order of the threads starting so the Discovery thread starts running before the dialog pops up and the connection thread starts after the dialog is closed