Note that waitFor callback is called synchronously