Code to launch the background thread