This is a homemade implementation of what async node.js mode does.