remove un-necessary global variables
Remove global variables that can be removed by a trivial way:
- simply dead globals
- or reference is a single source, so can be static
setting them static reduces the scope, that is a progress, but of course as for all static variables, the code is still not re-entrant