modified a global variable with an added if statement