added the ability to shutdown the background thread at will