made some changes to the threads method