added code to attach all threads.