Better tidy up of threads.