Example of an async waterfall in JavaScript