init code refactorization - global var

... at this point we need to do the rest of the init