non-blocking version of the final tutorial code