Remove use of global and replaced by function arguments.