refactored global vars