replaced the timeout with a loop

So it wasn't as long