Use promises instead of continuations