Make wait logic more intelligent

* Add doubles dependency