Here;s the use of promises / deferred objects, combined with named functions, makes this much easier to ready than several level of nested functions.