The old code, when calling `when`, did
* create a promise A

then asynchronously
* created a resolved pseudo-promise B
* do `B.then` some functions
* In these function create a second pseudo-promise C
* Do `C.then` with the original `when` callback function
* Do `A.then(C)`


This implies that when calling `when` we had a pending task that needs to get flushed. The new code simplifies this a lot and there are no pending tasks after calling `when`