removing timeouts, making code faster, fixed a race condition