added a waitTillDone function to give the user an easy way to wait on multiple threads to finish