switching to when.js for promises