init code refactorization - global var

it's rewritten in the branch.js script, not here... this is it's first time being written