Update to module with global environmental variable definitions
Reorganized code for re-use