Improve wait for state