Added thread to handle the server request so the GUI won't block.