replace global variables with a global class