removed waitingFor[] as an array since a thread cant wait for more than one thread