Added communication from the GUI to the background thread, added functionality for the logout button, and added error catching