Why not wait for the value to be zero? We should avoid sleeps, as in some cases 2 seconds may not be enough.