This code had some many-to-many branching behavior, so I had previously defined a lambda to avoid code duplication.
In this diff I swap the lambda vs. main function body parts, as this will be beneficial for the following diffs. Arguably it reads cleaner this way anyways if you're familiar with the async IIFE pattern.
Depends on D6428