It would be helpful, in these sections that combine large blocks of changed indentation with code changes, to highlight any non-obvious changes via comments here that the reviewer might otherwise miss. The changes to the "fail" callback are obvious, but not sure if there are others.