REFACTORING - more globals absorbed