async style (but with possible race condition)