Move callWhenReady to utils