Order setImmediate calls before setTimeout calls

Fixes #595
Nit pick, but I prefer to avoid `else` as much as possible, as it makes the code easier to read:

```js
if (a) {
    return 1;
}
if (b) {
    return -1,
}
```

And so on.