Reduce use of hard coded sleep in tests. Improve test stability