Sorry, I don't see the problem, all these variables are also in the outer scope ? So if you export the code for both branches in functions in the outer scope, they'll see these variables too, right ? Am I missing something ?