Different method for waiting for threads to finish