Replace when with bluebird.