use when.js and when/unfold to handle async