I don't think `global` is necessary here. Using `global` makes code harder to understand, maintain and test. Please use parameters and returns instead.