Replace when.all with when.map