I think you can still simplify this more. You can get away without having the `scopes` variable at all. In effect, `callbacks.length` is tracking the exact same thing. There's no need to track depth either.

On `endFunction()`, you can do something like:

```js
var lastFunction = callbacks.pop();
if (!lastFunction.handled) {
    // do stuff
}
```